Quantum Key Distribution (BB84) Demo

What is Quantum Key Distribution?

Quantum Key Distribution (QKD) allows two parties, Alice and Bob, to share a secret key securely using quantum mechanics. In the BB84 protocol, Alice sends qubits (e.g., polarized photons) in one of two bases: rectilinear (+, 0° or 90°) or diagonal (×, 45° or 135°). Bob measures them in a randomly chosen basis. If their bases match, they get the same bit. They publicly compare bases (not bits) to keep only matching cases, forming a shared key. Quantum properties like superposition and the no-cloning theorem ensure that an eavesdropper (Eve) introduces errors, making the key secure.

Try it: Send qubits one at a time or in batches. Toggle Eve to see how eavesdropping affects the key. Sift the key to finalize it and check the error rate!

Results

Alice's Data:

Bob's Data:

Shared Key:

Error Rate: N/A