Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Running examples a few times and it computer hanged #17

Open
UrsaEli opened this issue Mar 28, 2016 · 8 comments
Open

Running examples a few times and it computer hanged #17

UrsaEli opened this issue Mar 28, 2016 · 8 comments

Comments

@UrsaEli
Copy link

UrsaEli commented Mar 28, 2016

Hi Ryan,
I ran the examples, it seems to hang at the entropy part.

Thank you.

@Elfrania
Copy link

I face the same issue. I tried to abort and I get this:

in secret_int_to_points
coefficients = random_polynomial(point_threshold-1, secret_int, prime)
File "/usr/local/lib/python2.7/dist-packages/secretsharing/polynomials.py", line 34, in random_polynomial
random_coeff = randint(0, upper_bound-1)
File "/usr/local/lib/python2.7/dist-packages/secretsharing/entropy.py", line 41, in randint
byte_from_entropy = get_entropy(numbytes_of_entropy)
File "/usr/local/lib/python2.7/dist-packages/secretsharing/entropy.py", line 23, in get_entropy
return dev_random_entropy(numbytes)
File "/usr/local/lib/python2.7/dist-packages/secretsharing/entropy.py", line 14, in dev_random_entropy
return open("/dev/random", "rb").read(numbytes)

@shea256
Copy link
Owner

shea256 commented Mar 29, 2016

Hey @UrsaEli @Elfrania the reason for this is it is using /dev/random (which blocks if there's not enough entropy in the entropy pool) instead of /dev/urandom (which doesn't block). I'm going to change it to use the latter and then I'll let you know.

@shea256
Copy link
Owner

shea256 commented Mar 29, 2016

There was a controversy in the crypto community in the past over which was better, but it's become pretty clear that /dev/urandom uses a better model. I'll make this fix and we'll get you up and running in no time.

@shea256
Copy link
Owner

shea256 commented Mar 29, 2016

Actually this shouldn't be happening. @Elfrania I believe you might have an older version of this library. Can you let me know what the version number is? And if you do pip install secretsharing --upgrade is the problem fixed?

@Elfrania
Copy link

Same issue:

I just run this. The first time it may work, but if I run it a few times, it will hang.

from secretsharing import SecretSharer

total_number_of_shares = 3;
shares = SecretSharer.split_secret("c4bbcb1fbec99d65bf59d85c8cb62ee2db963f0fe106f483d9afa73bd4e39a8a", 2, total_number_of_shares);

print len(shares); # total_number_of_shares
print "Splitting into shares: ", shares;

@Elfrania
Copy link

I retested the code, it's slow but it's completing now.

Thank you, Ryan.

@shea256
Copy link
Owner

shea256 commented Mar 29, 2016

@Elfrania can you please type pip freeze in your command line and then let me know what the version number is for your copy of the secretsharing library?

Thanks!

@Elfrania
Copy link

secretsharing==0.2.6

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants