Tiny RSA

RSA was one of the first asymmetric cryptographic primitives in which the key used for encryption is different from the key used for decryption. The security of RSA is based on the difficulty of factoring large integers.

Key Generation

  1. Consider two large prime numbers and .
  2. Calculate
  3. Calculate
  4. Choose such that and is coprime to , or in other words
  5. Calculate such that

Keys

Private Key = Public Key =

Encryption

Decryption

See the examples in the tests.rs file

Security Assumptions

The security of RSA relies on the assumption that it is computationally infeasible to factor large composite numbers into their prime factors, known as the factoring assumption. This difficulty underpins the RSA problem, which involves computing eth roots modulo n without the private key.