Explainer · Quantum Key Distribution

BB84, precisely: how quantum key distribution works

Technical explainer 8 min read Engineer

BB84 is the canonical quantum key distribution protocol. It lets two parties establish a shared secret key whose security rests on physics rather than mathematical hardness. Here is how it actually works, step by step, with the bases, the error threshold, and the post-processing that makes it secure.

BB84 diagram: the two measurement bases and their polarization encodings, the Alice-to-Bob protocol flow over a quantum channel with Eve and a classical authenticated channel, and the curve of secret-key rate versus QBER dropping to zero at about 11 percent.
The two bases, the protocol flow, and the secret-key rate versus QBER. Click to enlarge.

The encoding: two mutually unbiased bases

BB84 encodes each bit into a single photon's polarization, using one of two bases chosen at random:

BasisBit 0Bit 1
Rectilinear (Z / +)|H⟩ horizontal|V⟩ vertical
Diagonal (X / ×)|D⟩ +45°|A⟩ +135°

The two bases are mutually unbiased: a state prepared in one basis and measured in the other yields 0 or 1 with exactly 50 percent probability and no information about the original bit. In qubit terms, |D⟩ = (|H⟩ + |V⟩)/√2 and |A⟩ = (|H⟩ − |V⟩)/√2. This is the property that the no-cloning theorem and measurement disturbance exploit.

The eight steps

  1. Random bit generation. Alice draws a long string of bits from a quantum random number generator, not a pseudo-random source.
  2. Random basis selection. For each bit she independently picks a basis (Z or X). The basis choice is independent of the bit value and independent across positions.
  3. Encoding. She prepares one photon per position from the (bit, basis) pair. Ideally single photons; in practice weak coherent pulses from an attenuated laser with mean photon number below 1, which is why the decoy-state method is needed to defeat photon-number-splitting attacks.
  4. Transmission. Photons travel through fiber (about 0.2 dB/km loss), free space, or satellite. Loss and noise degrade the signal and limit range and rate.
  5. Measurement. For each photon Bob independently picks a basis and measures. If his basis matches Alice's he recovers the bit; if not, the result is random.
  6. Sifting. Over a classical authenticated channel they announce their bases, never the bit values, and keep only the positions where the bases matched. That is roughly half the detected photons.
  7. QBER estimation. They publicly compare a random sample of the sifted bits and compute the quantum bit error rate. Noise contributes a few percent; eavesdropping adds more.
  8. Error correction and privacy amplification. They reconcile remaining errors (for example with Cascade or an LDPC code), then compress the key with a 2-universal hash function to erase the eavesdropper's partial knowledge, producing the final secret key.

Why it is secure: QBER and the threshold

Because measuring disturbs the states, any interception raises the error rate. The simplest attack, intercept-resend, where an eavesdropper measures every photon in a random basis and resends, forces a QBER of 25 percent. BB84's security threshold is about 11 percent (asymptotic, one-way reconciliation): below it a secret key can be distilled, above it the parties abort and keep nothing.

The secret-key rate R ≈ 1 − 2·h(QBER), where h is the binary entropy, falls to zero near 11 percent. Any full intercept-resend attack lands at 25 percent, far outside the secure region.

The two post-processing stages do the security accounting. Information reconciliation leaks at least n·h(QBER) bits to the eavesdropper while fixing errors. Privacy amplification then shortens the key by enough, bounded by the leftover hash lemma, to drive the eavesdropper's expected knowledge to negligible. What remains is a shared symmetric key used with ordinary encryption such as AES, or in the information-theoretic limit with a one-time pad.

Two dependencies the eight steps rely on

Classical-channel authentication. Every public message must be authenticated with an information-theoretic MAC (classically Wegman-Carter), keyed by a short pre-shared secret. Without it, a man-in-the-middle on the classical channel breaks everything. This is why QKD is really key growing: it expands a small initial secret into a large one, rather than creating a secret from nothing.

Finite-key security. The clean formulas are asymptotic. Real systems process finite blocks and use finite-key, composable security proofs with statistical bounds, which lower the usable rate and set minimum block sizes.

How this differs from post-quantum cryptography

BB84 is quantum cryptography: security from the laws of physics, delivered with specialized hardware (photon sources, detectors, fiber or satellite), and distance-limited. It is often confused with post-quantum cryptography, which is a different thing: PQC replaces vulnerable algorithms with new classical math (ML-KEM, ML-DSA, SLH-DSA) that runs on existing computers and networks, needs no special hardware, and is what standards bodies and regulators are mandating. QKD is a niche tool for a few high-assurance links; PQC is the transition virtually every organization will actually make. QuSafe focuses on the latter.

Planning your post-quantum transition?

QuSafe inventories your cryptography, scores it by risk, and builds a prioritized migration roadmap to the NIST post-quantum standards.

Request an assessment

A conceptual explainer of the standard BB84 protocol (Bennett and Brassard, 1984) and its modern security analysis (sifting, QBER, reconciliation, and privacy amplification). Figures approximate the asymptotic one-way secret-key rate R ≈ 1 − 2·h(QBER).