Simulation
Challenges
1
0
0
1
Bob
Alice
(source)
Quantum key distribution (BB84 protocol) with spin ½ particles
Controls
Alice and Bob need to share a secret perfectly random sequence of zeros and ones (a so-called secure key), but cannot meet in person. Classically this is impossible, as they can never be certain that the key was not intercepted during transmission. Quantum mechanics makes secure key generation possible!

In this simulation, you can help Alice and Bob generate a secure key using individual spin ½ particles sent from Alice to Bob. Alice prepares each particle in a spin-state that is either spin-up (value 1) or spin-down (value 0) along one of two orthogonal axes, denoted X and Z.

She sends each particle to Bob, who is equipped with a Stern-Gerlach apparatus (SGA), which consists of a region of non-uniform magnetic field aligned along a given axis. For spin ½ particles, the particles separate into two discrete streams, one deflected in the positive direction (outcome 1), one deflected in the negative direction (outcome 0). You can orient each SGA along two orthogonal axes X and Z. In this simulation, the states |↑〉 and |↓〉 are spin states with outcomes of 1 and 0 respectively in the Z-direction,
and |+〉 and |–〉 are spin states with outcomes of 1 and 0 respectively in the X-direction.

Alice and Bob note independent of one another the basis (X or Z) and value (0 or 1) for each particle sent from Alice to Bob. They know that their outcomes are perfectly correlated (if Alice sends 1, Bob measures 1; if Alice sends 0, Bob measures 0) when they both happened to choose the same basis. After completing the measurements, they publicly share the bases used for each measurement (but not the values!), and keep only those values for which their bases were the same - this is the key. Alice and Bob then exchange a small number of their values (which they then discard) to check for errors.

Your goal is to help Alice and Bob decide whether or not they have generated a secure key. How can they tell that an eavesdropper Eve has infiltrated their experiment?
Press the Controls button to send particle pairs to Alice and Bob and to eavesdrop by intercepting and resending particles.