-
Notifications
You must be signed in to change notification settings - Fork 155
Add RSA and Schnorr Examples #989
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
Conversation
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #989 +/- ##
=======================================
Coverage 72.05% 72.05%
=======================================
Files 160 160
Lines 35122 35122
=======================================
Hits 25306 25306
Misses 9816 9816 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
while exponent != UnsignedInteger::<N>::from_u64(0) { | ||
// If the current bit is 1, multiply the result by the base | ||
if exponent.limbs[N - 1] & 1 == 1 { | ||
result = (result * base).div_rem(modulus).1; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this is the naïf version. If we wanted to speed it up, we could use Montgomery
Co-authored-by: Pablo Deymonnaz <[email protected]>
Add RSA and Schnorr Examples
This PR adds two examples: RSA public-key cryptosystem and Schnorr signature scheme.
You'll also find a change in the function
sample_fr_elem()
ofgroth16
, because we noticed that it would be clearer to sample from entropy rather than always sampling from the same seed.These implementations are not cryptographically secure due to non-constant time operations, so they must not be used in production. They are intended to be just educational examples.