NDOVU · AUDIO EXPLAINER · LISTEN
Keys: space/K play-pause · J/L jump 10s · arrows on the waveform nudge 5s
The full briefing transcript, timed to the audio. Click any line to jump there; the current line lights up while you listen.
Shor's algorithm is a quantum algorithm, published by Peter Shor in 1994, that factors integers and computes discrete logarithms in polynomial time. Factoring splits a number into its prime building blocks, fifteen into three times five; a discrete logarithm is the exponent x hidden inside an equation like g to the x equals h mod p, where mod means the remainder after division by p. Polynomial time means the work grows with the digit count of the input rather than exponentially with it, and that is exactly the property long key lengths cannot outrun. In the next few minutes: how factoring becomes period finding, what the quantum core of one run does, how a single measurement turns into factors, and why no key length answers this algorithm.
The whole algorithm rests on one classical observation: both hard problems reduce to finding the period of a repeating sequence. Pick a random number g between 1 and N, where N is the number you want to factor, and write its powers modulo N: g, g squared, g cubed, and so on. The remainders repeat, and the repeat length r is called g's order. When r is even, and g to the r over 2 does not leave remainder N minus 1, two greatest-common-divisor computations expose a factor of N: one on g to the r over 2 minus 1, and one on g to the r over 2 plus 1. For a random g these checks pass with probability at least 1 minus 1 over 2 to the k minus 1, where k is the number of distinct odd prime factors of N; a failed draw simply retries with a fresh g. Here is the worked example, small enough to check by hand. Factor 15 with g equal to 7. The powers of 7 mod 15 run 7, 4, 13, 1, and then repeat, so the period r is 4. r is even, and 7 squared mod 15 is 4, which is not 14. The greatest common divisor of 48 and 15 is 3; the greatest common divisor of 50 and 15 is 5; and 15 equals 3 times 5. Writing the sequence out to find r worked here because 15 is tiny. At RSA size the sequence can run nearly N steps before it repeats, and closing exactly that gap is the quantum computer's job.
Four ideas from quantum mechanics carry the algorithm: superposition, amplitude, interference, and measurement. A quantum register can hold a superposition, many values at once, each carrying an amplitude, a number whose squared size is the probability that the value appears when the register is measured. Amplitudes have direction, so contributions to the same outcome can reinforce or cancel, and that is interference. Measurement samples one value, and the rest are gone. The algorithm is built so that the useful values are the ones whose amplitudes line up. One run then goes like this. The machine puts a first register into a superposition over all exponents x from 0 to q minus 1, where q is a power of two chosen between N squared and twice N squared, and computes g to the x mod N into a second register by repeated squaring. That step, modular exponentiation, is the bottleneck of the whole algorithm, and it runs on quantum registers because it is built reversible. The quantum Fourier transform, the quantum version of the classical tool for reading frequencies out of a repeated signal, then acts on the first register, and interference does the work: amplitudes near multiples of q over r reinforce each other and cancel everywhere else. Measuring the first register returns a value c that, with high probability, sits near a multiple of q over r.
The measurement outcome c is not the answer; it encodes the answer as a fraction. c over q approximates d over r, for some unknown constant d, within 1 over 2q. With q above N squared, that fraction is unique, and the continued-fraction expansion of c over q, a short classical algorithm that reads the best rational approximations out of a number, recovers r. One run yields r with probability at least phi of r over three r, where phi of r counts the numbers below r that share no factor with r. The bound shrinks only like 1 over log log r, so repeating the run a modest number of times makes failure rare, and classical tricks that also try twice r and three times r for each candidate cut the expected run count to a handful.
Every widely deployed public-key system sits on one of the two problems this algorithm solves. RSA rests on factoring and falls. Finite-field Diffie-Hellman and elliptic-curve cryptography rest on discrete logarithms and fall to the same period-finding core, because the 1994 paper solves both problems together. Symmetric cryptography is different in kind: AES and the SHA hash functions have no factoring or discrete-log structure for Shor's algorithm to exploit, and the quantum speedup against them, Grover's algorithm from 1996, is quadratic rather than exponential, so doubling a key length restores the margin. And size does not help on the public-key side. RSA-2048 and RSA-4096 sit in the same complexity class: the runtime still grows only polynomially with the digit count, so the larger modulus raises the work by a modest factor while the needed machine stays the same kind. There is no RSA key length that answers the algorithm. The deployed answer is replacement, not enlargement: the new standards, ML-KEM, ML-DSA, and SLH-DSA, rest on lattice and hash problems rather than factoring or discrete logarithms, at the price of bigger keys and ciphertexts on every handshake. One caveat keeps this a future threat rather than a present one. The run count stays polynomial, so the reason no cryptographically relevant quantum computer exists yet is the machine, not the arithmetic: the factoring circuit is specified over logical qubits, each one held accurate by error correction spread across many noisy physical qubits, and that overhead is the gap no laboratory has closed yet.