Skip to main content

RSA

Small-key RSA demonstration with public and private keys.

RSA is a public-key cipher built from two prime numbers. You pick primes p and q, multiply them to get the modulus n, and derive a public exponent e and a private exponent d. Anyone can encrypt with the public pair (e, n), but only the private exponent d can decrypt. See more at Wikipedia.

This is an educational demonstration with small keys. It is meant for learning and puzzle solving, not for protecting real secrets. Real RSA uses primes hundreds of digits long plus padding schemes that this demo does not implement.

Text mode encrypts each character's Unicode code point as its own ciphertext block. Number mode encrypts one integer m where 0 is less than or equal to m and m is less than n.