#Why this matters
Modern TLS, SSH, and code signing rely on asymmetric math that classical computers cannot invert quickly: integer factorization (RSA) and discrete logarithms (Diffie-Hellman, ECDH, ECDSA, Ed25519). A fault-tolerant Cryptographically Relevant Quantum Computer (CRQC) breaks all of these primitives completely.
Data is exposed even before a CRQC exists. Adversaries can record encrypted traffic today and decrypt it years later, a threat called Harvest Now, Decrypt Later (HNDL). To counter this, NIST finalized three Post-Quantum Cryptography (PQC) standards in August 2024: FIPS 203 (ML-KEM), FIPS 204 (ML-DSA), and FIPS 205 (SLH-DSA).
#Quantum algorithms: Shor vs. Grover
Quantum computers do not simply try every key in parallel. They use superposition and interference to amplify mathematical structure, so only algorithms matched to a problem's structure give dramatic speedups.
Shor's algorithm uses the Quantum Fourier Transform for polynomial-time period finding, which solves both integer factorization and discrete logarithms. As a result, Shor breaks RSA, finite-field Diffie-Hellman/DSA, and elliptic-curve cryptography (ECDH, ECDSA, Ed25519, X25519) at any practical key size.
Grover's algorithm accelerates unstructured search over N = 2^n items to roughly 2^(n/2) sequential quantum evaluations. Error-correction overhead and poor parallelization reduce real gains, and doubling symmetric key sizes restores full safety:
| Primitive | Classical security | Quantum impact | Recommended response |
|---|---|---|---|
| RSA-2048 / ECC P-256 | 112-128 bits | Broken by Shor (polynomial time) | Replace with ML-KEM / ML-DSA / SLH-DSA |
| AES-128 | 128 bits | Grover shifts search toward 64 bits | Prefer AES-256 for long-term margins |
| AES-256 | 256 bits | Retains ~128-bit quantum search resistance | Keep AES-256 |
| SHA-256 / SHA-3-256 | 128-bit collision | Quantum collision bounds stay costly | Keep SHA-256 or SHA-384/SHA-512 |
#Lattices and Learning With Errors (LWE)
A lattice L in R^n is the set of integer linear combinations z_1*b_1 + ... + z_n*b_n of n basis vectors. A "good" basis has short, near-orthogonal vectors; a "bad" basis has long, skewed vectors where finding the shortest nonzero vector (SVP) or closest lattice point (CVP) becomes intractable in high dimensions.
Learning With Errors (LWE) turns worst-case lattice hardness into cryptography. Given public matrix A (mod q) and b = A * s + e (mod q), the attacker must recover secret s despite small random error e. Without e (e = 0), A * s = b (mod q) reduces to ordinary linear algebra and collapses under Gaussian elimination:
# Toy LWE in SageMath: why the error vector e is mandatory
q = 97
F = GF(q)
A = matrix(F, [[1, 2, 3], [0, 1, 4], [5, 6, 0]])
s = vector(F, [14, 52, 8])
b_clean = A * s
print("Solved without noise:", A.solve_right(b_clean)) # (14, 52, 8)
e = vector(F, [1, -1, 1])
b_noisy = A * s + e
print("Naive solve with noise:", A.solve_right(b_noisy)) # (74, 83, 0)In SageMath, A.solve_right(b_clean) recovers (14, 52, 8) immediately, while [1, -1, 1] noise turns the naive solution into (74, 83, 0). Real schemes use hundreds of dimensions where lattice reduction scales exponentially.
NIST's lattice standards use Module-LWE (MLWE) over the polynomial ring R_q = Z_q[X] / (X^256 + 1) arranged into k x k modules, enabling fast Number Theoretic Transform (NTT) arithmetic and compact keys.
#NIST FIPS 203, 204, and 205
NIST standardized three post-quantum algorithms covering key establishment and digital signatures:
#FIPS 203: ML-KEM (from CRYSTALS-Kyber)
Classical TLS used Diffie-Hellman key exchange or RSA encryption. FIPS 203 standardizes a Key Encapsulation Mechanism (KEM) with three operations:
Notice that Bob does not choose K directly; Encaps(ek) derives a fresh 32-byte shared secret K alongside ciphertext ct, using an implicit-rejection Fujisaki-Okamoto transform so malformed ciphertexts yield pseudorandom keys instead of leaking dk.
| Parameter set | Security category | Encapsulation key ek |
Ciphertext ct |
Shared secret |
|---|---|---|---|---|
| ML-KEM-512 | Category 1 (~AES-128) | 800 bytes | 768 bytes | 32 bytes |
| ML-KEM-768 | Category 3 (~AES-192) | 1,184 bytes | 1,088 bytes | 32 bytes |
| ML-KEM-1024 | Category 5 (~AES-256) | 1,568 bytes | 1,568 bytes | 32 bytes |
#FIPS 204: ML-DSA (from CRYSTALS-Dilithium)
FIPS 204 is the primary general-purpose post-quantum signature standard, built on Module-LWE and the Fiat-Shamir with Aborts paradigm. Compared to Ed25519 (32-byte public key, 64-byte signature), ML-DSA keys and signatures are roughly 40 to 60 times larger:
- ML-DSA-44 (Category 2): 1,312-byte public key, 2,420-byte signature
- ML-DSA-65 (Category 3, recommended default): 1,952-byte public key, 3,309-byte signature
- ML-DSA-87 (Category 5): 2,592-byte public key, 4,627-byte signature
#FIPS 205: SLH-DSA (from SPHINCS+)
What if an unexpected algebraic breakthrough weakens Module-LWE? FIPS 205 provides algorithm diversity. SLH-DSA is a stateless hash-based signature scheme whose security rests solely on collision and second-preimage resistance of SHA-2 or SHAKE (SHA-3). Public keys are tiny (32 to 64 bytes), and signers need no mutable counter (unlike stateful LMS/XMSS), but signatures range from roughly 7.8 KB (128s small) to 49.8 KB (256f fast) and signing is noticeably slower than ML-DSA. That makes SLH-DSA ideal for offline root CAs and firmware verification rather than high-rate TLS connections.
You can test FIPS 203 and 204 locally with Open Quantum Safe's liboqs Python wrapper (oqs):
import oqs
with oqs.KeyEncapsulation("ML-KEM-768") as server, oqs.KeyEncapsulation("ML-KEM-768") as client:
ek = server.generate_keypair()
ct, client_secret = client.encap_secret(ek)
server_secret = server.decap_secret(ct)
assert client_secret == server_secret
print(f"ek={len(ek)}B ct={len(ct)}B shared={len(server_secret)}B")#Common mistakes
- Treating Grover as equal to Shor: Panic-migrating away from AES-256 or SHA-256 wastes engineering time while leaving RSA/ECDH key exchange exposed to HNDL.
- Reusing ML-KEM encapsulation keys carelessly without fresh randomness: Reusing ephemeral keys across sessions breaks forward secrecy, and non-compliant custom implementations without implicit rejection risk chosen-ciphertext attacks.
- Deploying pre-standard draft names: Early drafts of Kyber and Dilithium differ in domain separation and padding from final FIPS 203 and FIPS 204; verify exact NIST standard compliance in libraries.
- Ignoring signature size budgets: Dropping 3.3 KB ML-DSA-65 or 17+ KB SLH-DSA signatures into constrained IoT packets or legacy fixed-size certificate fields can break parsers silently.
#Summary
- Shor's algorithm breaks RSA, Diffie-Hellman, and ECC in polynomial time, making HNDL an urgent confidentiality threat for key exchange today.
- Grover's algorithm offers at most a quadratic speedup on unstructured search, so AES-256 and SHA-256/SHA-384 remain strong against quantum attackers.
- Lattice schemes such as Module-LWE rely on small noise terms to turn tractable linear systems into hard worst-case lattice problems.
- NIST standardized ML-KEM (FIPS 203) for key establishment, ML-DSA (FIPS 204) for general signatures, and SLH-DSA (FIPS 205) as a conservative hash-based backup.