Public key
RSA Demo
Builds tiny public/private keys from two primes, then encrypts a small number.
Playground
Change inputs and inspect the transformation
RSA uses modular exponentiation and the difficulty of factoring large composite numbers.
Output
Ciphertext
13
Decrypted
7
Steps
Transformation trace
Modulus
n = 5 x 11 => 55
The modulus is public and defines the arithmetic space.
Totient
phi(n) = (5 - 1) x (11 - 1) => 40
For two primes, phi(n) counts values coprime to n.
Private exponent
3 x d = 1 mod 40 => 27
d is the modular inverse of e under phi(n).
Encrypt
7^3 mod 55 => 13
The public key is (e, n).
Decrypt
13^27 mod 55 => 7
The private key is (d, n).