forked from zkcrypto/bls12_381
-
Notifications
You must be signed in to change notification settings - Fork 20
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
Add a random scalar generation that is uniformly distributed #125
Comments
This was referenced Nov 1, 2023
Merged
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Summary
The current implementation of a random scalar wraps a randomly generated bit-field around the modulus to ensure the scalar is valid. This approach makes us hit some scalars more than others.
Another approach would be to zero out the highest two bits but that in turn results in missing some scalars entirely.
Ideally we want to have a random scalar generation that is uniformly distributed.
Possible Solution
Use rejection sampling. This makes the random scalar generation not constant time but that shouldn't be a problem since no information on the scalar can be gained by analyzing the time it took to generate it.
The text was updated successfully, but these errors were encountered: