jqueiroz / python-sslib

A Python3 library for sharing secrets.
MIT License
9 stars 9 forks source link

FileNotFoundError #1

Open izamcc opened 4 years ago

izamcc commented 4 years ago

sorry I don't know if what I'm saying is ridiculous or stupid. I'm not even a developer >> just a student trying to get his project done at last minute but I tried running the exact code but I got this error :

FileNotFoundError: [WinError 3] The system cannot find the path specified: '/dev/random'

environment: VSCode , Win10 , Py3.8.2

for full Error message :

Traceback (most recent call last): File "xx", line 4, in shamir.to_base64(shamir.split_secret("this is my secret".encode('ascii'), required_shares, distributed_shares)) File "xx\Python\Python38-32\lib\site-packages\sslib\shamir\shamir.py", line 73, in split_secret with kwargs.get('randomness_source', randomness.RandomReader() if secret_length <= 65 else randomness.UrandomReader()) as randomness_source: File "xx\Python\Python38-32\lib\site-packages\sslib\randomness.py", line 15, in enter if os.stat("/dev/random"): FileNotFoundError: [WinError 3] The system cannot find the path specified: '/dev/random'

sorry again just trying to help

KaramMed commented 2 months ago

same issue for me, i've tried to work with this algorithm and most of the libraries online have problems, none of them work

leirn commented 2 months ago

The current implementation does not work with windows, only with Linux.

Why not use https://docs.python.org/3/library/secrets.html#module-secrets ? secrets.token_bytes should provide the best available solution on each context

leirn commented 2 months ago

The PR #4 offers a solution for this issue