← Back to all activities한국어 → 📖 Read the Article
🔐 RSA Encryption Lab

How does hard factoring
turn into internet security?

The online banking, logins and messaging you use every day are all encrypted, and at the heart of that encryption sits one very simple mathematical fact: multiplying two primes is easy, but splitting the product back into those two primes is extremely hard. Work through the idea here with small numbers. (Parts of this go to high-school level.)

Checking that 15 = 3×5 takes no time, and so does the reverse question, "what are the prime factors of 15?" The trouble starts as the numbers grow. A computer can multiply two primes into a number over 600 digits long in an instant, but working back from that number to the original two primes is beyond even a supercomputer. RSA uses exactly that asymmetry — easy to multiply, hard to factor — as its key.

🔢 Why is factoring hard? — try it yourself

Pick a number and type in divisors until you find one that divides it evenly. Counting your attempts shows how quickly this gets painful as the numbers grow.

🔑 Making RSA keys (with small numbers)

Real RSA uses primes hundreds of digits long, but to see the mechanism we will build a key from two tiny primes, p=5 and q=11.

✉️ Encrypt and decrypt

Think of the message as a single number, m. Encrypt it with the public key (e), then decrypt it back to the original with the private key (d) that only you hold.

🕵️ Why is it secure?

Anyone can see the public key (n and e). But recovering the original message from it means factoring n to find p and q. Our example (n=55) falls apart in three seconds as 5×11 — in real RSA, n is more than 600 digits long.

Factoring a number that size is estimated to take longer than the age of the universe, even using every computer that exists. That is why publishing n is safe — our online security rests on the fact that factoring is hard, something never proven mathematically but which nobody has yet found a fast method for.

🔮 Are there other schemes besides RSA?

Elliptic curve cryptography (ECC) uses a different hard problem — the discrete logarithm problem on an elliptic curve — instead of factoring. The mechanism differs but the goal is the same: find a problem that is easy in one direction and very hard to reverse. ECC reaches comparable security with far shorter keys than RSA, which is why it is popular on phones and IoT devices with limited battery and processing power, and in cryptocurrency wallets like Bitcoin's.

There is also a newer threat: quantum computers. A quantum algorithm called Shor's algorithm is known to solve both factoring and discrete logarithms far faster, at least in theory. Today's quantum computers cannot break real RSA yet, but a large, stable one would put both RSA and ECC at risk.

So "post-quantum cryptography", built on problems that stay hard even for quantum computers (lattice problems, for instance), is an active field. The US National Institute of Standards and Technology (NIST) published the first official post-quantum standards in 2024, and they are expected to gradually replace or run alongside today's RSA and ECC.

🧩 RSA encryption quiz

Question 1/10 · correct 0