math security RSA (Rivest–Shamir–Adleman) is a public-key cryptosystem widely used for secure data transmission. Its security relies on the practical difficulty of factoring the product of two large prime numbers.


The Setup (Key Generation)

  1. Select Primes: Choose two distinct large prime numbers and .
  2. Modulus: Compute .
    • is used as the modulus for both public and private keys.
  3. Totient: Compute .
  4. Public Exponent: Choose an integer such that and .
    • Common choice: .
  5. Private Exponent: Determine as the modular multiplicative inverse of modulo .

Keys:

  • Public Key: (Given to everyone).
  • Private Key: (Kept secret, along with ).

Encryption & Decryption

Let be the message (converted to an integer ).

Encryption: Sender uses the recipient’s Public Key.

Decryption: Recipient uses their Private Key.


Why It Works (Correctness)

We need to prove that . By Euler’s Theorem (Modular Arithmetic), .

  • Note: The security rests on the fact that if you only know , finding is equivalent to factoring into and . There is no known efficient algorithm for this on classical computers.