The world's first protocol that lets you create a perfectly random key, protected by the laws of quantum physics
Imagine you are Alice and you want to send a secret message to Bob. There's an eavesdropper — Eve — trying to listen in on your conversation.
In classical cryptography, Eve can simply copy all your messages without being noticed. But what if there were a way to build a key such that any eavesdropping attempt would be detected immediately?
That's exactly what BB84 does. It's security guaranteed at the level of the laws of physics. Eve's attempt to listen in doesn't just risk getting caught — it inevitably leaves traces. Why? To intercept a quantum signal, Eve has to measure it, and measurement in the quantum world always changes the particle's state. These changes show up as errors, which Alice and Bob can easily spot.
BB84 relies on a fundamental property of quantum mechanics: you cannot secretly "peek" at a quantum particle. Let's walk through it step by step:
Alice prepares photons (particles of light), encoding a bit (0 or 1) in each one. For every bit, she randomly picks one of two encoding methods — a "basis" (think of it as "+" or "×"). It's like choosing an alphabet to write the same letter.
Bob receives the photons. For each one, he also randomly picks a basis to measure it with.
If his basis matches Alice's — he's guaranteed to get the correct bit (0 or 1).
If the bases don't match — the measurement result is random (0 or 1 with 50/50 odds), even if the photon was perfect.
Alice and Bob openly (over an ordinary, unprotected channel!) announce which basis they used for each photon — but not the bits themselves.
Bits sent and measured with matching bases are kept. These become the foundation of the secret key.
Bits with mismatched bases are discarded.
Now Alice and Bob have a preliminary key made of matching bits. To check it's clean, they openly compare a small random sample of those bits.
If there was no Eve: almost all of Alice's and Bob's test bits will match. A few percent of mismatches come from natural equipment noise (about 2% in the game).
If Eve was listening: to intercept a photon she had to measure it. Like Bob, she guessed the basis blindly. Half the time she guessed wrong, irreversibly changed the photon's state and sent Bob a spoiled photon. If Eve intercepts every photon, about 25% of the test bits will disagree; if she intercepts only some, there will be proportionally fewer errors.
The test bits were revealed publicly, so they no longer go into the key. The remaining bits go through error correction: Alice and Bob compare parities of small blocks and fix the rare mismatches without revealing the bits themselves.
Then comes privacy amplification: the key is compressed, for example by replacing groups of bits with their XOR. If Eve knew some of the bits, after compression her knowledge turns into random noise.
What will you actually do in the simulation?
In the game you don't just read about BB84 — you live through it from every role. You'll see how randomness in choosing bases turns into a key whose eavesdropping cannot be hidden, and understand why quantum cryptography is not magic but physics.
The BB84 protocol was proposed by Charles Bennett and Gilles Brassard in 1984 (hence the name). It was the first practically realizable quantum key distribution protocol, opening a new era in cryptography.
In the ideal BB84 protocol, if Eve intercepts every photon and forwards it onward, she guesses the basis with 50% probability. When she guesses right, she leaves no trace. When she guesses wrong, she introduces an error with 50% probability. In total: 50% (chance of picking the wrong basis) × 50% (chance that creates an error) = 25% errors in the key.
In the game you choose how Eve behaves. If she intercepts every photon, the QBER is about 25% plus noise — Eve is obvious. In random mode she is absent 30% of the time, and otherwise intercepts 5% to 35% of photons: the QBER grows by about a quarter of the intercepted share, and a weak Eve can be hard to tell from noise — just like in reality.
If you want to dive deeper into the theory, here are the key topics worth studying:
Photon polarization, diagonal and circular polarization, representing states on the Bloch sphere
Why you can't make an exact copy of an unknown quantum state, and how this protects the protocol
How Alice and Bob find and fix mismatches in the key (Cascade, LDPC protocols) while revealing as little as possible about it
Side-channel attacks, detector attacks, blinding attacks, and how to defend against them
Satellite quantum networks, fiber-optic systems, commercial QKD solutions
Reconciliation, privacy amplification, authentication of the classical channel
Today, BB84 and its variants have potential applications in:
Now that you understand the basics, it's the perfect time to try it in practice and see the protocol in action!
In the game you can put everything you've learned into practice and watch BB84 unfold in an interactive simulation