Skip to content

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

Merged
merged 27 commits into from
Apr 7, 2025
Merged

Add RSA and Schnorr Examples #989

merged 27 commits into from
Apr 7, 2025

Conversation

nicole-graus
Copy link
Contributor

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() of groth16, because we noticed that it would be clearer to sample from entropy rather than always sampling from the same seed.

⚠️ Disclaimer

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.

@codecov-commenter
Copy link

codecov-commenter commented Apr 1, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 72.05%. Comparing base (7fe890e) to head (3e5a7b2).

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.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@nicole-graus nicole-graus marked this pull request as ready for review April 1, 2025 15:45
@nicole-graus nicole-graus requested a review from a team as a code owner April 1, 2025 15:45
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;
Copy link
Collaborator

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

@diegokingston diegokingston added this pull request to the merge queue Apr 7, 2025
Merged via the queue into main with commit ca84326 Apr 7, 2025
8 checks passed
@diegokingston diegokingston deleted the add_examples branch April 7, 2025 20:36
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

Successfully merging this pull request may close these issues.

5 participants