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

feat: RSA digital signature system #21

Merged
merged 44 commits into from
Jan 26, 2025
Merged

feat: RSA digital signature system #21

merged 44 commits into from
Jan 26, 2025

Conversation

MarcosNicolau
Copy link
Owner

@MarcosNicolau MarcosNicolau commented Jan 18, 2025

Description
Implements RSA key generation, this process consists of:

  1. Generating two random primes p,q.
  2. Computing n as p*q.
  3. Computing $\lambda(n)$ (Carmichael's totient function).
  4. Compute d as the modular inverse of e in $\lambda(n)$.
  5. Release n,e as the public key and d as the private key.

Considerations
To generate the two random prime numbers we do:

  1. A factor test with the first 1000 prime numbers: this allows us to quickly discard non-prime numbers.
  2. If (1) passes, we run a stronger primality test: Solovay–Strassen test.

With keys of large bits (up to 1024) the algorithm becomes too slow, it takes at lest around 100 seconds to run the Solovay–Strassen test without taking into account the time it takes to find a prime number first (this is more random and is not so deterministic). Via benchmarks (will be uploaded in a future pr) the bootleneck has been identified in the biguint division algorithm. Issue #30 with more details.

Finally, all the references used while writing this has been added to the docs.

Closes #28

@MarcosNicolau MarcosNicolau force-pushed the feat/rsa-system branch 4 times, most recently from 880acfe to 253bd20 Compare January 26, 2025 19:02
@MarcosNicolau MarcosNicolau marked this pull request as ready for review January 26, 2025 19:03
@MarcosNicolau MarcosNicolau merged commit 1e3f23c into main Jan 26, 2025
1 check passed
@MarcosNicolau MarcosNicolau deleted the feat/rsa-system branch January 26, 2025 19:24
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.

Key generation
1 participant