Quantum cryptography
Practical study notes on quantum cryptography: BB84 and entanglement-based QKD, the no-cloning theorem, attacks and security ideas, with worked exam-style answers and common mistakes.
Drafted with Aria, reviewed by the AiCanCode.org team · Updated . How we write and check our notes. Spotted an error? Use Give Feedback at the bottom of the page.
Why it matters
Quantum cryptography gives engineers a method to distribute secret keys with security based on the laws of quantum mechanics rather than computational hardness. It is used in secure communications hardware, quantum networks, and in systems (for example banking or government links) where information-theoretic security or long-term secrecy is required.
Key ideas
Basis: a complete orthonormal set of states used for preparation or measurement. In BB84 we use two conjugate bases: the rectilinear basis (|0> = horizontal, |1> = vertical) and the diagonal basis (|+> = 45°, |-> = 135°). Always state which basis when preparing or measuring.
Sifting: the step in QKD where sender (Alice) and receiver (Bob) publicly compare which bases they used and keep only the bits where bases matched.
Quantum bit error rate (QBER): the fraction of sifted bits where Alice and Bob disagree. QBER is used to estimate eavesdropper presence and to decide whether to proceed to error correction and privacy amplification.
No-cloning theorem (exact statement): There is no unitary operation U and fixed blank state |b> such that for every pure state |ψ> of a quantum system we have U(|ψ> ⊗ |b>) = |ψ> ⊗ |ψ>. Assumptions: standard quantum mechanics (linear, unitary evolution). This is the formal reason an unknown quantum state cannot be copied perfectly.
Proof (step-by-step, commonly asked in exams):
- Suppose U is a unitary with U(|ψ>⊗|b>) = |ψ>⊗|ψ> and U(|φ>⊗|b>) = |φ>⊗|φ> for two arbitrary states |ψ>, |φ>.
- Take inner product of the two results and use unitarity (inner products preserved): <ψ|φ> = (<ψ|φ>)^2.
- Solve z = z^2 where z = <ψ|φ> (a complex number with |z| ≤ 1). Solutions are z = 0 or z = 1.
- For arbitrary non-orthogonal states 0 < |z| < 1, contradiction occurs. Hence no such universal U exists.
BB84 protocol (exact step-by-step as exam answer):
- Alice chooses a random bit string a and an independent random basis string b (0 = rectilinear, 1 = diagonal).
- For each index i, Alice prepares a photon in the polarization corresponding to bit a_i in basis b_i and sends the photons to Bob.
- Bob independently picks random basis choices b'_i and measures each incoming photon in basis b'_i, obtaining result a'_i (if no detection, record as loss).
- Over an authenticated classical channel, Bob announces for which positions he detected a photon. Alice and Bob discard positions with losses.
- Alice and Bob publicly announce their basis strings b and b' and keep (sift) only positions where b_i = b'_i. The remaining bits form the raw key.
- They estimate QBER by revealing a random sample of the raw key bits and computing the fraction that disagree. If QBER > threshold, abort. Under idealized, asymptotic single-photon BB84 with one-way post-processing, a positive secret key is possible only if Q < ≈11% (from 1 − 2·H2(Q) > 0).
- If acceptable, they perform error correction (information reconciliation) over the classical channel to align keys, then privacy amplification to reduce any partial information an eavesdropper (Eve) may have, giving the final secret key.
Diagram to draw for an exam: draw a horizontal timeline with Alice on the left and Bob on the right. Show a row of photon pulses leaving Alice labelled with chosen bit and basis (e.g., H, V, +, −). Between them draw an arrow labelled "quantum channel (possible Eve)". On Bob’s side, draw detectors with random basis choices labelled. Below, draw the classical authenticated channel linking Alice and Bob with arrows both ways and label steps: detection announcement, basis announcement, sifting, error estimation, error correction, privacy amplification.
Intercept–resend attack (simple model): Eve intercepts each photon, measures in a random basis, records outcome, resends a photon prepared in the measured state to Bob. This attack introduces errors because when Eve picks the wrong basis (50% of the time), her measurement collapses the state and Bob’s measurement (if his basis matches Alice’s) will be wrong with probability 50%, producing an average QBER = 25% on sifted key. (Derivation shown in Worked examples.)
Security idea: Quantum measurement disturbs non-orthogonal states. By sampling and estimating QBER, Alice and Bob set an upper bound on Eve's information. Then privacy amplification reduces Eve's information to arbitrarily small levels. Full unconditional security proofs (Shor–Preskill and later) are mathematically involved and assume correct device models or use device-independent methods.
Other protocols: entanglement-based QKD (E91): Alice and Bob share entangled pairs, measure in chosen bases, use correlations and Bell tests to certify security. Advantage: source can be untrusted if Bell violation is observed.
Practical issues: authentication of classical channel (needed to prevent man-in-the-middle), detector side-channels (detector blinding attacks), finite-key effects (finite sample sizes reduce secure key rates), photon-number-splitting attack when using weak coherent pulses (requires decoy-state methods).
Formulas
QBER = (number of mismatched sifted bits) / (number of sifted bits) — QBER is unitless (fraction), applies to sifted key after basis reconciliation.
Expected sifted fraction = 1/2 — fraction of transmitted bits remaining after sifting when Alice and Bob choose basis uniformly at random; unitless, applies for BB84 with two bases.
For intercept-resend: P(error) = 1/4 — expected QBER = 0.25 (unitless); derived in worked example.
Binary entropy H2(x) = -x·log2(x) - (1-x)·log2(1-x) — H2 is measured in bits, used to compute Shannon entropy of a binary distribution; applies when 0 < x < 1.
Lower bound on asymptotic secret fraction (one formulation for BB84) r ≥ 1 - 2·H2(Q) — r is key bits per sifted bit (bits), Q is QBER (unitless). Applies under idealized assumptions and for certain error-correction/privacy-amplification strategies. In practice (one-way error correction with efficiency f_EC ≥ 1), a common expression is r ≥ 1 - f_EC·H2(Q) - H2(Q), and r is taken as max(0, RHS).
No-cloning inner-product condition: <ψ|φ> = (<ψ|φ>)^2 — used in proof of no-cloning theorem; inner products are unitless.
Worked examples
Intercept–resend attack: compute expected QBER (exam-style answer)
- Setup: Alice sends N photons prepared in BB84 states. Eve intercepts each photon and measures in a basis chosen at random (rectilinear or diagonal), then resends a photon in the outcome state to Bob. Bob measures in a random basis.
- Step 1: For any given signal where Alice used basis A and Bob used basis B, consider cases: a) If Eve chooses the same basis as Alice (probability 1/2), Eve measures correctly and resends the correct state; if Bob uses same basis as Alice, no error introduced. b) If Eve chooses the opposite basis (probability 1/2), her measurement result is uncorrelated with Alice's bit; when Bob uses the same basis as Alice, his result equals Alice's bit with probability 1/2.
- Step 2: We are interested in the sifted key where Bob’s basis matches Alice’s basis (this happens with probability 1/2 overall, but QBER is conditional on these positions). Conditional on basis match, Eve had picked the wrong basis with probability 1/2 and then Bob's bit equals Alice's with probability 1/2, so error probability = (1/2)·(1/2) = 1/4.
- Final answer: QBER = 25%.
Sifting yield + numeric example (exam-style)
- Given: Alice sends 1000 BB84 states, Bob measures all.
- Expected sifted bits = 1000 × (probability bases match) = 1000 × 1/2 = 500.
- If measured QBER in sample is 3% and below threshold, they proceed to error correction and privacy amplification.
- Final answer: 500 sifted bits (before discarding sample used for QBER estimate and before error correction).
Model answer: Prove the no-cloning theorem (concise exam model)
- Statement: a universal cloning unitary U that copies arbitrary state |ψ> into |ψ>⊗|ψ> with a fixed blank |b> cannot exist.
- Proof: Assume U exists. For two states |ψ>, |φ>, apply U and take inner product: <ψ|φ> = (<ψ|φ>)^2. Hence <ψ|φ> is 0 or 1. But for arbitrary non-orthogonal states (<ψ|φ> not 0 or 1) contradiction. Therefore no universal U exists. QED.
Common mistakes
- Forgetting the need for authenticated classical channel (man-in-the-middle risk otherwise).
- Mixing probabilities: when calculating intercept–resend QBER, students sometimes forget conditioning on sifted positions (bases matching) and get 12.5% instead of 25%.
- Using the asymptotic key-rate formula r ≥ 1 - 2·H2(Q) without stating assumptions (e.g., infinite-key limit, specific error-correction direction).
- Neglecting device vulnerabilities (detector side-channels) when claiming unconditional security.
For your exam
Kinds of questions:
- Definitions: define QKD, sifting, QBER, privacy amplification.
- Short notes: describe BB84 steps, explain no-cloning theorem, list practical attacks and countermeasures.
- Derivations: prove no-cloning theorem; derive expected QBER for intercept–resend; compute sifted fraction.
- Numericals: given N transmitted and measured QBER, compute sifted bits and remaining key after revealing a sample.
- Diagrams: draw the BB84 preparation/measurement timeline and label quantum and classical channels.
What full-marks answers include:
- Precise definitions with bold terms (as above), clear assumptions, and step-by-step derivations.
- For protocols: list every step and the reason (e.g., why sifting is needed).
- For security: state assumptions (authenticated classical channel, device model) and identify attack models considered.
- For diagrams: clearly show Alice, quantum channel (possible Eve), Bob, and the classical authenticated channel with labelled protocol steps.
Quick check
- In BB84, what fraction of transmitted bits remain after sifting (on average)?
- What is the QBER introduced by an intercept–resend attack (random-basis Eve) on the sifted key?
- State the no-cloning theorem in one sentence.
Answers: 1/2; 25% (1/4); No universal unitary can clone an arbitrary unknown quantum state (i.e., there is no operation that maps |ψ>⊗|b> to |ψ>⊗|ψ> for all |ψ>).
Finished this topic? Mark it so your progress, study plan and readiness keep up.
Stuck on something here?