Cryptography

RSA

The last lesson showed the magic of a matched key pair. RSA was the first practical way to actually build one, and decades later it still guards a huge share of the internet — every padlock in your browser bar has probably used it. Its trapdoor is beautifully simple to describe.

Multiplying is easy; un-multiplying is hard

RSA rests on a single asymmetry: multiplying two large prime numbers together is trivial, but taking the result and working out which two primes produced it — factoring — is brutally hard. Your public key is built from that product, which you can publish. Your private key is the two secret primes. Anyone can multiply; essentially no one can factor a large enough number back into its primes. That is the whole trapdoor.

Build a key pair and use it. Pick two secret primes below — the whole key pair falls out of them — then encrypt a number with the public key and watch it decrypt back with the private one. It’s real RSA, just with tiny primes you could factor by hand.

Modulus n = p × q
φ(n) = (p−1)(q−1)
Public exponent e
Private exponent d = e⁻¹ mod φ
Public key (publish it):
Private key (keep secret, derived from p and q):
m = — encrypt: mᵉ mod n → c = — decrypt: cᵈ mod n →

Named after three people

RSA stands for Rivest, Shamir and Adleman, the three researchers who published it in 1977. It was the breakthrough that turned the abstract two-key idea into a working system the world could use for both encryption and digital signatures.

Why the keys keep growing

There is a catch. As computers get faster, factoring creeps a little closer to feasible, so the primes have to keep getting bigger to stay safely ahead. RSA keys have climbed over the years from 512 bits to 1024, then 2048, and 4096 today. Bigger keys mean more data to store and slower calculations — and that cost bites hardest on phones, smartcards and tiny embedded chips that don’t have power to spare.

That growing-key problem is exactly what elliptic curves solve. An elliptic-curve key reaches the same security as RSA with far less: a 256-bit elliptic-curve key is roughly as strong as a 3072-bit RSA key. Smaller and faster matters enormously on limited hardware — which is why Bitcoin, and most modern systems, chose elliptic curves over RSA.

So how does a curve give you a smaller, stronger key? That’s the trapdoor we build next.

Key takeaways

  • RSA’s trapdoor: multiplying two big primes is easy, but factoring the result back into them is brutally hard.
  • As computers speed up, RSA keys must grow (1024 → 2048 → 4096 bits), which is costly on limited hardware.

Check yourself

What hard problem is RSA’s security based on?

Why do RSA keys keep getting bigger over time?

Spotted an error or have feedback on this lesson? Suggest a correction ↗

Comments

Powered by Nostr — reply from any Nostr client, and zap the lesson over Lightning.