Decrypted Message:

Public Key (N):

Private Key (d):

Encrypted Message:


RSA (Rivest-Shamir-Adleman) is a widely used public-key encryption algorithm, developed by Ron Rivest, Adi Shamir, and Len Adleman in 1977. It employs a pair of keys, public and private, to encrypt and decrypt messages, ensuring secure communication over potentially insecure channels. The security of RSA relies on the difficulty of factoring the product of two large prime numbers.

  1. Key Generation:
    • Choose two large prime numbers, p and q.
    • Calculate n = p * q.
    • Compute f(n) = (p - 1)(q - 1).
    • Select a public exponent (e) such that 1 < e < f(n), and gcd(f(n), e) = 1.
    • Calculate the private exponent (d) as d ≡ e^(-1) (mod f(n)).
    • Public Key: PU = {e, n}, Private Key: PR = {d, n}.
  2. Encryption (By Sender):
    • Convert the message (M) to an integer.
    • Compute the ciphertext (C) using the public key: C ≡ M^e (mod n).
  3. Decryption (By Receiver):
    • Compute the original message (M) using the private key: M ≡ C^d (mod n).