QKD Logo QKD Simulations
Protocol Simulation

BB84

Alice encodes bits as photon polarizations in a randomly chosen basis. Bob measures in his own random basis. They discard bits where their bases differed - leaving a shared secret key.

12

Bit 0   Bit 1    Faded = discarded (bases differ)


Sifted Key
-
Error Rate
-
Legend

Sender: Alice  |  Receiver: Bob

Circles represent photons / qubits

Blue = bit 0  |  Red = bit 1

Rectilinear basis (+): vertical = 0, horizontal = 1

Diagonal basis (×): 45° top-left to bottom-right = 0; 135° = 1

Faded circles: photons discarded because Alice and Bob's bases did not match


Notes

Even without Eve, real quantum channels have ~1–5% background noise (QBER). If the error rate exceeds ~11%, Alice and Bob abort - that threshold is where Eve's interference becomes statistically unmistakable.

This simulation uses a small qubit count for clarity. In practice, billions of photons would be exchanged and thousands of bits sampled to estimate the error rate.

At high photon counts the canvas switches to a compact grid view - individual photons are too small to render meaningfully at hundreds of qubits.