|shor⟩ · N = p × q

How a quantum computer breaks RSA

RSA is safe because multiplying two primes is easy and splitting the product back apart is not. Elliptic curves rest on a similar one-way problem. Shor's algorithm turns both into a search for a repeating pattern, and finding repeating patterns is exactly what quantum interference is good at. Try it below with numbers small enough to watch.

|one-way⟩

Easy one way, hard the other

Anyone can check that 61 × 53 = 3233. Going backwards from 3233 takes trial and error. For the 617-digit numbers in a 2,048-bit RSA key, the best classical method would run for longer than the universe has existed.

Public factoring records. The RSA-2048 line is a rough extrapolation from the complexity of the number field sieve.
NumberSizeFactoredEffort
RSA-129426 bits1994a volunteer internet effort, months
RSA-768768 bits2009almost 2,000 single-core years
RSA-250829 bits2020about 2,700 core-years
RSA-20482,048 bitsnever~10¹¹ × RSA-250 classically · under a week on a large quantum computer (estimate)
a 2,048-bit modulus · 617 digitsillustrative digits

Every public RSA key contains a number like this. Its two prime factors are the private key.

|lab⟩

Shor's algorithm, step by step

This lab simulates the quantum part exactly for small numbers. The steps are the same for a 2,048-bit key; only the size changes. Read the full explanation.
Random basea = 2

1 · classical check

gcd(2, 55) = 1, so a shares no factor with N. Now the hard part: find the period of aˣ mod N.

2 · the repeating pattern

The values of ax mod N repeat every r = 20 steps; each colour band is one period. A classical computer has to walk the sequence to see it repeat. For a 2,048-bit N the period can have hundreds of digits, so that walk never ends.

3 · quantum interference

The quantum computer puts all Q = 4,096 values of x into superposition, computes ax mod N for all of them at once, then applies the quantum Fourier transform. Everything cancels except sharp peaks at multiples of Q / r. One measurement lands on a peak.

Not measured yet.

4 · from period to factors

Measure first. The outcome y is close to a multiple of Q / r; a continued-fraction expansion of y / Q recovers r.

N = ? × ?

Why the last step works: if r is even, ar − 1 = (ar/2 − 1)(ar/2 + 1) is a multiple of N, so N shares a factor with each bracket. Euclid's gcd algorithm pulls it out instantly. Unlucky choices of a (odd r, or ar/2 ≡ −1) just mean trying another a.

|curves⟩

Elliptic curves fall the same way

ECDH, ECDSA and Ed25519 rely on the discrete logarithm problem on a curve: given points P and k·P, find k. A variant of Shor's algorithm finds k the same way it finds a period.

Elliptic-curve keys are short, so the machine needed is no larger than for RSA. One published estimate puts P-256 at about 2,330 error-corrected qubits (Roetteler et al., 2017). Most TLS key exchange today is elliptic-curve.

Read: elliptic curves under Shor →

RSA hard problem

N = p × q → find p, q

Diffie–Hellman hard problem

gk mod p → find k

Elliptic-curve hard problem

k·P → find k

Shor's algorithm

Solves all three in polynomial time.

|grover⟩

Symmetric keys bend, they do not break

Grover's algorithm searches n possibilities in about √n steps. For a k-bit key that is 2k/2 instead of 2k−1. The steps are slow and cannot be split across machines efficiently, so the practical risk is small. The fix is simple anyway: 256-bit keys. Read more.

classical brute force · 2^127 guesses on average

5.4 × 10²¹ years

Grover · about 2^64 steps

584 years

verdict

Fine for most data today. For secrets that must last decades, and for CNSA 2.0, use AES-256.

Both columns assume a generous billion guesses per second. Real error-corrected Grover steps are far slower, and splitting the search across machines only helps by the square root of their number.

|impact⟩

Encryption breaks backwards. Signatures break forwards.

Key exchange and encryption

Anything recorded today can be decrypted on Q-day: old TLS sessions, VPN traffic, PGP mail, RSA-wrapped backups. The damage reaches back in time, which is why key exchange is fixed first.

Signatures

A forged signature only works after Q-day: fake software updates, fake certificates, fake payment instructions. But roots of trust, firmware keys and long-lived certificates take years to replace, so they must start now too.

AlgorithmWhere you find itAttackWhat happensReplace with
RSA encryptionTLS 1.2 RSA key exchange, PGP, S/MIME, RSA-wrapped data keysShorRecorded data is decryptedML-KEM, hybrid first
ECDH / DHTLS 1.3, SSH, IPsec and VPNs, messagingShorRecorded sessions are decryptedX25519MLKEM768, then ML-KEM
RSA / ECDSA signaturesCertificates, JWT, SAML, code signing, documentsShorForgery after Q-dayML-DSA, SLH-DSA
Ed25519SSH keys, Git and package signingShorForgery after Q-dayML-DSA
Firmware rootsSecure boot, HSM firmware, devices in the fieldShorMalicious updates acceptedLMS / XMSS, ML-DSA
AES-128, 3DESBulk encryption, payment systemsGroverSecurity margin roughly halvedAES-256
SHA-256Hashing, HMAC, integrityGroverStill strong; CNSA 2.0 asks for SHA-384SHA-384 / SHA-512

|code⟩

What it looks like in your code

The scanner finds lines like the red ones. The advisory for each finding shows the replacement that works on your platform today, or tells you that your provider is not ready yet.
Java (JDK 24+) · key exchange
- KeyPairGenerator.getInstance("RSA").initialize(2048);+ KEM kem = KEM.getInstance("ML-KEM");  // ML-KEM-768 by default
Go 1.24+ · key exchange
- priv, _ := ecdh.P256().GenerateKey(rand.Reader)+ dk, _ := mlkem.GenerateKey768()
nginx with OpenSSL 3.5 · TLS groups
- ssl_ecdh_curve X25519:prime256v1;+ ssl_ecdh_curve X25519MLKEM768:X25519:prime256v1;
OpenSSH 9.9+ · sshd_config
- KexAlgorithms curve25519-sha256+ KexAlgorithms mlkem768x25519-sha256,curve25519-sha256
Node.js · JWT signing
- jwt.sign(claims, key, { algorithm: 'RS256' })+ // ML-DSA for JOSE is still a draft: track the advisory
Terraform (AWS KMS) · signing key
- key_spec = "ECC_NIST_P256"+ key_spec = "ML_DSA_65"

|cloud⟩

And outside your code, on the cloud

Much of an organisation's cryptography is a setting in someone else's service. Some of it is already safe, some can be switched today, and some waits on the provider. The readiness tracker shows each provider's status with an as-of date.
mixed by provider

Managed key services (KMS, Key Vault, Cloud KMS)

RSA and EC keys for signing and wrapping are quantum-vulnerable. Post-quantum key types are arriving provider by provider.

safe if AES-256

Symmetric KMS keys and envelope encryption

Data keys under AES-256-GCM are already fine. The risk is any RSA key used to wrap them.

check your policy

Load balancers and CDNs

TLS policies decide the key exchange. Many already offer hybrid ML-KEM policies to switch on.

waiting for standard

Managed certificates

Public web certificates are still RSA or ECDSA everywhere; post-quantum web PKI is not standardised yet.

upgrade required

Service mesh and internal mTLS

Istio, Envoy and Linkerd follow the TLS library underneath. Hybrid key exchange arrives with the upgrade.

upgrade required

VM and bastion SSH keys

RSA, ECDSA and Ed25519 host and user keys. OpenSSH 10 negotiates post-quantum key exchange by default.

check with vendor

Cloud HSMs and payment HSMs

Firmware decides what algorithms exist. Ask the vendor for a dated post-quantum roadmap.

already safe

API request signing

Most cloud APIs sign requests with HMAC-SHA256, which quantum computers do not break.

Read: cryptography in the cloud →

Next: the algorithms that have no repeating pattern to find.

The new algorithms →