Ndovu elephant mark ndovu

CONCEPT · GROVER’S ALGORITHM

Grover’s algorithm

Grover’s algorithm searches an unstructured space of N items in about √N quantum steps: one oracle call flips the answer’s amplitude, inversion about the mean amplifies it, and the quadratic speedup halves a symmetric key’s effective exponent, which doubling the key length restores.

Lov K. Grover, STOC 1996unstructured search, O(√N) quantum stepscontext: the quantum threat guide
01 · The frame

Grover’s algorithm (1996) searches an unstructured space of N items in about √N quantum steps. Unstructured is the operative word: the candidates carry no order to exploit, a phone directory in completely random order, which is the paper’s own picture. Any classical algorithm needs at least N/2 looks to find one name with 50% probability; Grover’s needs on the order of √N steps, and the paper places it within a small constant factor of the fastest possible quantum search (the tight analysis, Boyer-Brassard-Høyer-Tapp, followed the same year).

The speedup is quadratic, not exponential: the work shrinks to its square root, rather than dropping from exponential to polynomial the way factoring does under Shor. That difference decides what survives the quantum threat. Shor’s algorithm finds a structure (periods) inside factoring and discrete logarithms, so RSA and elliptic-curve cryptography fall at any key length; Grover’s loop exploits nothing about the keys it searches, so its quadratic dent is answered by doubling the key length. Symmetric cryptography survives, and the migration replaces public-key algorithms only.

02 · The mechanism

The setup.

A space of N candidates, exactly one marked: a function f(x) returns 1 for the answer and 0 for everything else, and one f(x) evaluation is the unit of work, the oracle call. Key search has this shape: every AES key is a candidate until one decrypts the message, and nothing about the keyspace says which.

The quantum primitives.

A quantum register can hold a superposition: many values at once, each carrying anamplitude, a number whose squared size is the probability that the value appears when the register is measured. Amplitudes have sign, so they add up or cancel out, and arranging that addition and cancellation (interference) is the algorithm’s entire job. Measurementsamples one value; the other candidates are gone.

The loop, two moves.

Move one, the oracle flip: one circuit call marks the answer by flipping the sign of its amplitude. Move two, inversion about the mean: every amplitude a is replaced by 2m − a, where m is the mean of all amplitudes. The flip puts the answer’s amplitude just below the mean, so the inversion throws it above the mean while all the others dip; each pass rotates the state by 2θ toward the marked candidate, where sin θ = 1/√N.

Measure near (π/4)√N iterations. The closed form: after k iterations the success probability is sin²((2k+1)θ), and the count that maximizes it sits just under (π/4)√N. Past the peak the rotation overshoots and the marked amplitude falls again, which is why the count stops there. The oracle flip and the inversion together areamplitude amplification, and the same loop runs wherever a predicate can be built into an oracle: key search, hash preimage, collision finding.

Amplitude amplification over 16 keys, one marked: the marked key's amplitude grows 0.25, 0.69, 0.95, 0.98 across three iterations while each unmarked key's amplitude shrinks 0.25, 0.19, 0.08, then dips to -0.05; the success probability peaks at 96% after three iterationsmarked key’s amplitudeeach unmarked key (15 of them)N = 16, sin θ = 1/4, 2θ per iterationafter k = 0 iterationsmarked 0.25, P = 1/16 ≈ 0.0625after k = 1 iterationmarked 0.69, P = 121/256 ≈ 0.4727after k = 2 iterationsmarked 0.95, P = 3721/4096 ≈ 0.9084amplitudes dip negativeafter k = 3 iterationsmarked 0.98, P = 63001/65536 ≈ 0.9613(π/4)√16 = 3.14: three iterations, then measure. A fourth lands at 0.5817: past the peak the marked amplitude falls again.

The four iterations, exactly. N = 16 keys, one marked, θ = arcsin(1/4); the values are exact fractions, since sin 3θ = 3 sin θ − 4 sin³ θ = 3/4 − 1/16 = 11/16 and the unmarked amplitudes follow from the same identity.

After k iterationsMarked amplitudeEach unmarked amplitudeSuccess probability
k = 01/41/41/16 = 0.0625
k = 111/163/16121/256 = 0.4727
k = 261/645/643721/4096 = 0.9084
k = 3251/256−13/256 (negative)63001/65536 = 0.9613
03 · What it dents, and what survives

Grover’s loop is generic: it needs a predicate and nothing else, so every construction whose security rests on the cost of trying candidates feels the same quadratic dent. What survives is whatever can restore its margin by growing a parameter instead of changing its mathematics.

TargetThe dentWhat survives
Symmetric keys (AES, ChaCha20)dented: the exponent halves, 2^n keys to 2^(n/2) oracle callssurvives at doubled lengths: AES-256 puts 2^128 back
Hash preimage (find the input for a digest)dented: 2^n falls to 2^(n/2)survives at standard sizes: SHA-256 stays 2^128, SHA-384 2^192
Hash collisions (two inputs, one digest)dented: the 2^(n/2) birthday bound (collisions need about the square root of the space) falls to about 2^(n/3) (the Brassard-Høyer-Tapp algorithm)survives with larger output: SHA-384 lands back at 2^128
MACs (HMAC and friends)dented only through the hash and key insidesurvives: no structural break for Grover to exploit
Public-key cryptography (RSA, DH, ECC)not Grover’s story: Shor’s polynomial-time period finding removes them at any key lengthreplaced, not lengthened (see the Shor page)

The last row is the line the whole migration sits on. Shor’s algorithm attacks the structure inside public-key cryptography (period finding, again), and no key length answers it; Grover’s quadratic search is the entire quantum story for hashes, MACs, and symmetric ciphers, and a doubled parameter answers it.

04 · The key-length arithmetic

The exponent is what moves. Grover’s runtime against an n-bit keyspace is on the order of √(2^n) = 2^(n/2) oracle calls, one full cipher evaluation per call: AES-128’s 2^128-key search becomes about 2^64 calls (18,446,744,073,709,551,616 of them), and AES-256’s 2^256-key search becomes about 2^128 calls. The exponent halves; doubling the key length puts it back. Hashes take the same arithmetic: preimage 2^n → 2^(n/2), and collisions 2^(n/2) → ~2^(n/3) by the Brassard-Høyer-Tapp algorithm.

TargetClassical costQuantum costCNSA 2.0 picks
AES-128 key search2^128 keys, half tried on average~2^64 oracle calls (1.8 x 10^19)AES-256
AES-256 key search2^256 keys~2^128 oracle callsAES-256: the margin is back
SHA-256 preimage2^256~2^128SHA-384 or SHA-512
SHA-256 collision2^128 (birthday)~2^85 (BHT)SHA-384
SHA-384 collision2^192 (birthday)~2^128 (BHT)SHA-384

This is why CNSA 2.0’s symmetric answer keeps AES and SHA and moves each up one size: AES-256 for all classification levels, SHA-384 or SHA-512 (the NSA’s suite pairs them with ML-KEM-1024, ML-DSA-87, and LMS/XMSS as the public-key and firmware replacements). The standards guide’s size section carries the byte costs of the replacements.

Public-key cryptography has no row in this table. RSA and ECC rest on problems Shor solves in polynomial time, so a longer RSA modulus raises the attacker’s work by a modest factor while the needed machine stays the same kind (the Shor page carries that arithmetic). Symmetric cryptography gets a doubling; public-key cryptography gets replaced.

05 · Verify it yourself
ClaimPrimary sourceStatus
Classical search: at least N/2 looks for 50% probability; the quantum algorithm finds the answer in O(√N) steps, within a small constant factor of the fastest possible quantum search; the v3 proof runs on the "inversion about average" interpretationGrover, STOC 1996; arXiv:quant-ph/9605043verified (abstract and paper-page notes)
Success probability after k iterations has a closed form; the iteration count for near-certainty follows from it; Grover’s probe count is within factor 2 of optimalBoyer, Brassard, Høyer, Tapp, "Tight bounds on quantum searching", PhysComp 1996; Fortsch. Phys. 46, 493 (1998)verified (abstract)
Amplitude amplification: oracle phase flip plus inversion about the mean; measurement after about (π/4)√N iterationsNielsen & Chuang, Quantum Computation and Quantum Information, ch. 6textbook
Collision search in O((N/r)^(1/3)) function evaluations, with a space-time tradeoff; for an n-bit hash that is ~2^(n/3) against the 2^(n/2) birthday boundBrassard, Høyer, Tapp, LATIN’98; arXiv:quant-ph/9705002verified (abstract)
CNSA 2.0 keeps AES and SHA at larger sizes: AES-256 for all classification levels, SHA-384 or SHA-512, alongside ML-KEM-1024, ML-DSA-87, and LMS/XMSS as the public-key and firmware replacementsNSA, CNSA Suite 2.0 page and FAQ v2.2verified (multiple concordant sources; nsa.gov blocks plain fetches)
Worked example, N = 16: θ = arcsin(1/4); sin 3θ = 11/16 exactly (sin 3a = 3 sin a − 4 sin³ a); the unmarked amplitudes 1/4, 3/16, 5/64, −13/256 follow from the same identity; (π/4)√16 = 3.14this page’s arithmetic, checkable by handchecked (recomputed numerically at authoring)

Textbook depth: Nielsen & Chuang, Quantum Computation and Quantum Information, the Grover chapters, for the amplitude-amplification walkthrough and the iteration count. The N = 16 values above are exact dyadic fractions: from sin θ = 1/4 the triple-angle identity gives sin 3θ = 11/16, and each next row follows the same way.

06 · Where it bites

The halved exponent is permanent, and it is small next to the hardware gap. 2^64 oracle calls, each a full AES circuit run on a quantum register, is a magnitude no built machine approaches; the estimates in the quantum threat guide track how far real hardware sits from cryptographically relevant scale. The migration arithmetic does not wait for that machine: the doubling is decided on paper, once.

The threat guide puts Grover next to Shor in the full what-breaks picture, and the standards guide carries what CNSA 2.0 and the NIST standards require in response, with the deadlines both set. The public-key replacements named there, ML-KEM and ML-DSA, rest on lattice problems; the lattices concept page carries that machinery.