Skip to content

BB84 key distribution

Alice and Bob want to talk privately. If they share a random secret key as long as their message, the one-time pad makes the message perfectly secure. The hard part is getting the key to both of them without anyone else seeing it. That is the key distribution problem.

Classical solutions rest on mathematical assumptions, such as factoring being hard. BB84, published by Charles Bennett and Gilles Brassard in 1984, rests on physics instead: anyone who listens to the quantum channel leaves evidence.

This lesson assumes you know the material in the Quantum Information track up to measurement.

Alice can encode a bit in either of two bases:

Basis Bit 0 Bit 1
++ (rectilinear) ∣0⟩\ket{0} ∣1⟩\ket{1}
×\times (diagonal) ∣+⟩\ket{+} ∣−⟩\ket{-}

Bob can measure in either basis. Measuring in the ++ basis is an ordinary measurement. Measuring in the ×\times basis means applying HH first, which you saw distinguishes ∣+⟩\ket{+} from ∣−⟩\ket{-} perfectly.

Everything follows from one fact. If Bob uses the basis Alice used, he reads her bit correctly. If he uses the other basis, his result is a fair coin flip and carries no information about her bit.

Check

Alice encodes the bit 1 in the ×\times basis. Bob measures in the ++ basis. What does he get?

  1. Alice sends. For each qubit she picks a random bit and a random basis, and sends the corresponding state.
  2. Bob measures. For each qubit he picks a random basis, measures, and writes down the result.
  3. They compare bases, not bits. Over an ordinary public channel they announce which basis they used for each qubit. They keep the rounds where the bases matched and discard the rest. This step is called sifting.
  4. They test for eavesdropping. They reveal a random sample of the kept bits and compare. If too many disagree, they abort.

About half the rounds survive sifting, and without interference Alice and Bob hold identical bits in those rounds. Run it a few times with the eavesdropper switched off.

SimulatorRun BB84

Now switch Eve on. She uses the most obvious attack, called intercept and resend: she measures each qubit as it passes and sends Bob a fresh qubit prepared according to what she saw.

Her problem is that she does not know Alice’s basis, and Alice does not announce it until after Bob has measured. So Eve has to guess.

  • Half the time she guesses right. She reads the bit correctly and resends the correct state. No trace.
  • Half the time she guesses wrong. Her result is random, and she resends a state in the wrong basis. When Bob then measures in Alice’s basis, his result is random too, so it is wrong half the time.

In the kept rounds, the chance of an error is therefore 12×12=14\tfrac12 \times \tfrac12 = \tfrac14. Use Send 10,000 more with Eve on and off to check the two rates.

A 25% error rate is impossible to miss. If Alice and Bob compare just 50 sample bits, the chance that Eve slips through with no mismatches is (3/4)50(3/4)^{50}, less than one in a million.

Eve would like to copy each qubit, pass the original along untouched, and measure her copy once the bases are announced. The no-cloning theorem forbids exactly this: no physical process copies an unknown quantum state. Any attack that gains information about the key must disturb the states, and the more Eve learns the more errors she causes.

BB84 as described is a sketch. A working system has to deal with several more things:

  • Real channels are noisy, so some errors occur without any eavesdropper. Alice and Bob cannot tell noise from Eve and must assume the worst. They correct the errors and then compress the key to squeeze out whatever Eve might know. For BB84 this works when the error rate is below roughly 11%.
  • The public channel must be authenticated. Otherwise Eve can simply pretend to be Bob. Authentication needs a short shared secret to begin with, so BB84 is strictly a way of growing a key.
  • Devices are imperfect. The security proof is about the ideal protocol. Practical attacks have targeted the gap between it and real hardware, for example detectors that can be blinded with bright light.

The next lessons take these in turn.

RecallAnswer from memory, then check
LessonFinish this lesson