RSA Encryption Algorithm

Learn the RSA public-key cryptosystem with step-by-step key generation, encryption, and decryption. Understand the mathematical foundations of modern cryptography.

RSA Parameters

Quick Examples:

Results

Original Message
HELLO

Step-by-Step Process

No steps to show yet. Start by generating RSA keys.

RSA Algorithm Explanation

Key Generation Process:

  1. 1. Choose Primes: Select two large prime numbers p and q
  2. 2. Calculate n: Compute n = p × q (public modulus)
  3. 3. Calculate φ(n): Compute φ(n) = (p-1)(q-1) (Euler's totient)
  4. 4. Choose e: Select e such that gcd(e, φ(n)) = 1
  5. 5. Calculate d: Find d such that (d × e) ≡ 1 (mod φ(n))
  6. 6. Keys: Public (n,e), Private (n,d)

Encryption/Decryption:

  • Encryption: C = M^e mod n
  • Decryption: M = C^d mod n
  • Security: Based on difficulty of factoring large numbers
  • Key Size: Typically 1024, 2048, or 4096 bits
  • Applications: Digital signatures, secure communication
  • Asymmetric: Different keys for encryption/decryption

Important Notes for Exams:

  • • RSA security depends on the difficulty of factoring n = p × q
  • • The private key d is kept secret, while public key (n,e) can be shared
  • • For large messages, RSA is often used to encrypt symmetric keys (hybrid cryptography)
  • • Padding schemes like OAEP are used in practice to prevent attacks
  • • RSA can also be used for digital signatures by reversing the key usage