← teaching

RSA encryption

RSA with small primes, so every number stays readable. The public exponent is fixed at e = 65,537, the value used in practice. Pick two primes to generate a key pair, then pick a message and watch it encrypt with the public key and decrypt with the private key.

An adjustable RSA example with a fixed public exponent of 65,537, with notes explaining that the totient is computed from each prime minus one and that the private exponent is derived from the totient.

Step 1 · choose two different primes

Modulus

The modulus is the product of the two primes and is made public.

Totient

φ = (p − 1) × (q − 1)

Exponents

Public key · shared

Private key · secret

Step 2 · choose a message

Step 3 · encrypt with the public key

Step 4 · decrypt with the private key