UbQbit / Insights / Q-Day experiments
  1. 1The qubit
  2. 2Shor
  3. 3Grover
  4. 4Signatures
  5. 5Your deadline

Guess the key

Race a quantum search to a hidden key. You’ll lose. Then see why that still doesn’t put AES encryption in danger.

You versus Grover’s search Exact simulation

Each square is one possible key, and only one of them is right. You get a few guesses first. Then a quantum computer gets the same number of steps, using Grover’s search.

Find the key.
Keys

The quantum search, one bar per key

Each bar is a key’s amplitude. Square it and you get the chance of that key coming up when the search ends. Unlike a chance, an amplitude can go below zero, and the search relies on that.

Score

You0 / 0
Grover0 / 0

What AES is

AES is the encryption that does most of the actual work. It scrambles files, messages and web traffic using a secret key, and the same key unscrambles them. Nobody has found a shortcut through it, so without the key the only way in is to try keys until one works.

That’s the game above, at a much larger size. A 128-bit AES key is one of 2128 possibilities, which is 340 followed by 36 zeros.

How the quantum search won

You could only open one square at a time, and each wrong guess ruled out one key. The quantum search never opens a square. It gives every key an amplitude, all equal to begin with, then repeats two moves.

First, a check built into the circuit, called the oracle, flips the right key’s amplitude below zero. For AES, that check would run the key on a message whose scrambled form is already known. It can recognise the right key without anyone learning which key it is.

Then every amplitude is flipped to the other side of the average, the dashed line. Because the right key was pulled so far below the average, the flip throws it far above. Each round makes it stand out more, and after a few rounds nearly all the chance sits on the right key.

The number of rounds is about three quarters of the square root of the number of keys: 3 rounds for 16 keys, 6 for 64 and 12 for 256. You got the same number of guesses, and the odds were never on your side.

So why is AES still safe?

A square root shrinks big numbers a lot, but not enough. The square root of a million is a thousand. The square root of 2128 is 264, so Grover’s search makes a 128-bit key about as hard to find as a 64-bit one, and a 256-bit key about as hard as a 128-bit one. Drag the slider to see what that means in years.

Real key sizes Generous assumptions
Machines working on it

Ordinary computer, guessing

Grover’s search

Both columns assume a billion steps a second per machine. That’s far more generous to the quantum computer than to the ordinary one, since each step of Grover’s search means running the whole of AES on qubits.

Adding machines barely helps

Try the machine buttons. Ordinary guessing splits neatly, so a million computers each take a millionth of the keys and finish a million times sooner. Grover’s search doesn’t split that way. Its rounds have to run one after another, so a million quantum computers finish only a thousand times sooner. Mathematicians have proved that no cleverer quantum search does better, so this isn’t something better engineering will fix. NIST, the US standards body, builds the same limit into how it rates new encryption.

So AES-128 isn’t the urgent problem, and AES-256 is out of reach however you measure it. That’s why CNSA 2.0, the NSA’s list of encryption approved for US national security systems, simply asks for AES-256.

The real problem is elsewhere

Both ends of a conversation need the same AES key, and they usually agree on it over the internet using RSA or a close relative called elliptic-curve cryptography. Those are exactly what Shor’s algorithm breaks.

Record that key exchange today, break it with a quantum computer later, and you have the AES key without ever touching AES.

That’s what people mean by “harvest now, decrypt later”. Digital signatures, which prove who sent something, rely on the same breakable maths. The fix is to replace those public-key methods with new ones, which is where the next experiment goes.