Please enable JavaScript to use CodeHS

Cryptography

Post-Quantum Cryptography

Every padlock icon in your browser is protected by a math trick that is easy to do one way and nearly impossible to undo the other way. A future quantum computer could change that. Here's what's actually at risk, and how encryption is already getting ready.

Cybersecurity ~11 min Middle & High School
Recap

Why today's encryption is hard to break

Encryption means turning a readable message into scrambled text that only someone with the right key can turn back into words. Almost every secure connection on the internet — your bank, your school portal, that little padlock next to a web address — relies on a system called RSA encryption to do this.

RSA is built on a neat mathematical trick. Multiplying two enormous secret prime numbers together is fast — a computer does it instantly. But if all you can see is the giant result, working backward to figure out which two primes were multiplied (a process called factoring) is brutally slow. Make those primes large enough, and factoring the result would take an ordinary "classical" computer far longer than the age of the universe.

That gap — easy to do one way, essentially impossible to undo the other way — is the entire reason your passwords and credit card numbers stay safe today. If you want to see the wrap-around math (called the modulus) that actually powers this trick, check out Encryption and the Modulus. We won't repeat all of that here — the short version is enough for what's coming next.

Key idea: RSA isn't unbreakable in theory. It's just so slow to break in practice, with an ordinary computer, that it might as well be unbreakable. That "in practice" is doing a lot of work — and it's exactly what quantum computers threaten to change.


New Machines

What makes a quantum computer different

A quantum computer is a computer that stores information in qubits instead of ordinary bits, and uses the rules of quantum physics to explore many possibilities at once — but only for certain very specific kinds of math problems. It is not a magic "faster version" of your laptop. For everyday tasks like streaming video, texting a friend, or loading a webpage, a regular computer already wins.

If qubits are new to you, the What Is Quantum Computing? tutorial covers them from scratch. Here, the one fact that matters is this: some of the very specific problems quantum computers are good at happen to include the exact kind of math that keeps RSA safe.

Keep it honest: a quantum computer big and reliable enough to threaten RSA does not exist yet. Today's quantum computers are still small, experimental, and error-prone. The concern in this tutorial is about tomorrow, not today's hardware.


The Discovery

Shor's algorithm, in one paragraph

Back in 1994, a mathematician named Peter Shor discovered something unsettling: a set of quantum instructions — now called Shor's algorithm — that, if it ever ran on a large enough, reliable quantum computer, could do the "hard direction" of RSA's trick fast. Instead of factoring a huge number taking longer than the universe has existed, a big enough quantum computer running Shor's algorithm could plausibly do it in hours or days. No formulas needed to understand the impact: the one-way street that protects RSA today would stop being one-way.

This is not a loophole waiting to be patched — it is genuine, peer-reviewed math that mathematicians and physicists agree is correct. The catch is scale: running Shor's algorithm on the real, gigantic numbers used by RSA requires a quantum computer with far more qubits, and far more error correction, than anything that exists today. Most experts think that kind of machine is still years away. But "years away" is not "never," and that distinction matters a lot for the next section.


The Real Risk

"Harvest now, decrypt later"

Here is the part that is not science fiction and not years away. Encrypted internet traffic — the scrambled data flying between your device and a server — can be recorded and saved by anyone listening, right now, without breaking any of it. An attacker does not need to crack the encryption today. They can just store the scrambled data on a hard drive and wait.

This strategy is called "harvest now, decrypt later." The attacker harvests (collects and stores) encrypted data today, and plans to decrypt it later, once a quantum computer powerful enough to run Shor's algorithm finally exists.

Why this matters right now: harvest now, decrypt later is only a real threat to information that needs to stay secret for a long time — medical records, government secrets, or long-lived business data that must remain private for decades. For that kind of data, waiting until quantum computers actually arrive before switching encryption methods is already too late. Whatever gets copied and stored today stays vulnerable forever, no matter when the encryption on everything else finally gets upgraded.


The Fix

What post-quantum cryptography actually is

Post-quantum cryptography is a set of new encryption algorithms designed to resist attacks from both classical computers and quantum computers. Instead of relying on factoring — the exact math problem Shor's algorithm threatens — these algorithms are built on entirely different hard math problems, ones that, as far as anyone currently knows, quantum computers have no fast shortcut for.

The leading approach uses something called lattice problems. Picture a grid of points, but stretched out across many more directions than we can actually draw or picture — dozens or hundreds of dimensions instead of just two or three. Hide a secret message as one very specific point buried among an astronomical number of nearby points on that grid. Finding your way back to the exact right point without the key turns out to be extremely hard, whether you're a classical computer checking possibilities one at a time or a quantum computer using Shor's-algorithm-style tricks — because those tricks simply don't apply to this kind of grid problem.

Key idea: post-quantum cryptography does not use quantum computers to encrypt anything. It runs on the same ordinary computers we already have. It's just built on a different, tougher kind of math problem — one that survives both kinds of attackers.


Already Happening

Real-world progress

This is not a hypothetical future plan — it is already rolling out. NIST, the U.S. National Institute of Standards and Technology, ran a multi-year public competition: cryptographers around the world submitted candidate post-quantum algorithms, and other cryptographers tried their best to break them. The survivors became official, published post-quantum encryption standards that companies and governments can now build on.

Browsers, operating systems, and major companies have started rolling out hybrid encryption: combining a classical algorithm (like the ones used today) with a post-quantum algorithm at the same time, on the very same connection. That way, a connection protected today needs to survive an attack on both layers to be broken — safe against today's classical attackers, and safe against tomorrow's quantum ones, at the same time.

Key idea: you don't have to wait for a quantum computer to show up before this starts protecting you. Hybrid encryption is quietly showing up in ordinary software updates right now, closing the harvest-now-decrypt-later window before it becomes a real problem.


Interactive

Test the locks yourself

Below are three different kinds of encryption, drawn as locks. Click an attack button on each lock to see whether it holds firm or breaks — first against a classical computer, then against a quantum computer.

Click both attack buttons on each lock to compare all three.

RSA-style lock

Today's most common encryption

Lattice-style lock

A post-quantum algorithm

Hybrid lock

Classical + post-quantum, combined


Your Turn

Check yourself

1. In your own words, what does "harvest now, decrypt later" mean?

Sample answer: It means an attacker collects and saves encrypted data today, even though they cannot read it yet, and plans to decrypt it later once a powerful enough quantum computer exists.

2. Big quantum computers that could break RSA don't exist yet. Why does switching to post-quantum encryption matter today anyway?

Sample answer: Some information, like medical records or government secrets, needs to stay private for decades. If that data is encrypted with RSA today and gets copied by an attacker now, it will still be exposed the moment a large quantum computer arrives, no matter how far away that is. Switching to post-quantum encryption now protects that long-lived data before it's ever collected.


Check Yourself

Quick quiz

1. Why is factoring a giant number hard for a classical computer today?

2. What does "harvest now, decrypt later" mean?

3. What is post-quantum cryptography?

Keep learning

You've seen why RSA is hard to break today, why a large enough quantum computer would change that, and how post-quantum cryptography keeps data safe either way. For the wrap-around math behind RSA's "easy one way, hard the other way" trick, see Encryption and the Modulus. And since proving who you are online is part of the same 2026 security story, this tutorial's series continues with What Is a Passkey?.

Part of the Identity, Login, and Encryption in 2026 series from CodeHS.