Two people who have never met, shouting across a crowded room where everyone hears everything, can end up knowing a number that nobody else in the room knows. That sounds impossible, and it is the thing every encrypted connection you have ever made depends on. It works because some sums are easy one way and brutally hard backwards.
Both sides publicly agree a base and a prime. Each then picks a private number, raises the base to it, and shouts the result. Each raises what they heard to their own private number — and both land on the same value. An eavesdropper hears both public numbers and the base and still cannot get there, because working backwards from ga mod p to a is the discrete logarithm problem, and nobody has a fast way to do it.
RSA goes further: one key locks, a different key unlocks, and you can hand the locking one to the world. Multiply two primes to get n. Anyone can encrypt with n and e. Only someone who knows the original two primes can work out d and undo it. Everything below is really computed — change the message and watch the ciphertext change with it.
The public key contains n, and n is just two primes multiplied. Find them and the private key falls out. Press Try to break it and the page will do exactly that by trying every candidate — which works fine at four digits, takes a noticeable pause at ten, and stops being an option shortly after. Nothing about the method changes; only how long it takes.
Real keys are not seven digits. An RSA key is 2048 bits — about 617 digits — and the best known method is not trial division but the number field sieve, which is far cleverer and still nowhere near fast enough. The table is the honest comparison: how the estimated effort climbs, and where the line for "no computer that will ever exist" sits.
| key size | digits | best-known effort | status |
|---|
The modular exponentiation, the key generation, the encryption and the decryption on this page are genuine RSA, done with exact big-integer arithmetic. The round trip works because the maths works, not because anything is stored and handed back: encrypt a message, and the only route to the plaintext is the private exponent. Diffie–Hellman is likewise the real protocol.
What is unreal is the scale, deliberately, so that the breaking step finishes while you watch. These keys are thousands of times too small to protect anything, and the page will happily factor them. Real deployments also do several things this page skips: padding schemes, because textbook RSA leaks information and is not safe as-is; using the public-key step only to agree a symmetric key, because RSA is far too slow for bulk data; and authentication, because agreeing a secret with a stranger is useless if you cannot tell who the stranger is. That last gap is what certificates exist for, and it is the part that actually goes wrong in practice.