RSA Calculator

This is a teaching tool for the RSA algorithm, worked on numbers small enough to check by hand. Give it two primes and it returns the modulus, the totient, a public exponent and the private exponent found by extended Euclid, with the inverse check written out; separate actions encrypt a whole number, decrypt one, and run the extended Euclidean algorithm on any pair of numbers with every division step shown. The primes are capped at 50,000 so all the arithmetic stays exact. Nothing produced here is secure: a modulus this size is factored in microseconds, and textbook RSA without padding is broken even with large primes.

Calculator Type

Pick two different primes. Everything else follows from them.

An odd prime up to 50,000. Small on purpose: every step has to stay printable.
An odd prime up to 50,000. Small on purpose: every step has to stay printable.
Leave blank and the smallest workable exponent is chosen for you. It must be coprime to phi(n).
Widget

c = m^e mod n. The message has to be a whole number below n.

Widget

m = c^d mod n, the same operation as encryption with the other exponent.

Widget

The step that turns e and phi(n) into d. It also answers the plain question of what the greatest common divisor of two numbers is, and how to write it in terms of them.

Widget