shea256 / secret-sharing

A system for securely splitting secrets with Shamir's Secret Sharing Scheme
MIT License
489 stars 144 forks source link

Usage of pow() #12

Open calve opened 9 years ago

calve commented 9 years ago

Hello,

I did a quick review inside the code, and found the following exponentiation = (long(x)**i) % prime at https://github.com/onenameio/secret-sharing/blob/master/secretsharing/polynomials.py#L52

I wonder if there is any reason not to use Python's built-in pow(x,y,z) which is, according to the documentation

compute more efficiently than pow(x, y) % z

I thought about timing-attack on pow() but cannot find anything on the internet

shea256 commented 8 years ago

Hi @calve thank you for submitting this.

I'm still unclear on why this other function is better. Can you explain further?

calve commented 8 years ago

Hi, I would say the pow() function is better because it is in stdlib :)

As far as I know, there is no such thing as a cryptographically secure modular exponentiation, so I do not see any reason not to use the builtin.