Shor’s Algorithm
The quantum algorithm that factors integers exponentially faster than any known classical algorithm, threatening RSA encryption.
Shor’s algorithm, discovered by Peter Shor in 1994, efficiently factors large integers. This is devastating for RSA and similar cryptosystems that rely on factoring being hard.
The Impact
Classical factoring of an -bit number: (best known) Quantum factoring with Shor’s: or better
For a 2048-bit RSA key:
- Classical: Millions of years
- Quantum: Hours to days (with a large fault-tolerant quantum computer)
How It Works
Shor’s algorithm has two main parts:
1. Classical Reduction
Factoring is reduced to period finding:
- Pick random (the number to factor)
- Find the period of
- Use to find factors via
2. Quantum Period Finding
This is the quantum part:
- Create superposition over all :
- Compute quantumly:
- Apply Quantum Fourier Transform to first register
- Measure to get information about the period
The QFT causes interference that reveals the period with high probability.
Circuit Overview
|0⟩^n ──H^⊗n──┬─── QFT ── Measure ──→ period info
│
|0⟩^m ────────⊕── (modular exponentiation)
Resource Requirements
To factor an -bit number:
- Qubits: (roughly qubits)
- Gates: (dominated by modular exponentiation)
- T-gates: Many millions for cryptographically relevant sizes
Current Status
| Milestone | Status |
|---|---|
| Factor 15 | Done (2001, with tricks) |
| Factor 21 | Done (2012) |
| Factor 2048-bit | Requires ~4000 logical qubits, millions of physical qubits |
We’re far from breaking real-world RSA. But it’s a matter of engineering, not fundamental obstacles.
Implications
- Cryptographic transition: Moving to post-quantum cryptography
- Security timeline: Data encrypted today could be decrypted later (“harvest now, decrypt later”)
- Motivation for quantum computing: Major driver of quantum research and funding
Variants
- Simplified Shor’s: For specific numbers with known structure
- Quantum resource estimation: Ongoing research to reduce requirements
- Hybrid approaches: Some classical preprocessing
Historical Note
Shor’s algorithm was the “killer app” that launched serious interest in quantum computing. It showed quantum computers could solve a problem of real-world importance exponentially faster.
See also: Quantum Fourier Transform, Quantum Phase Estimation, Post-Quantum Cryptography, Quantum Advantage