Quantum Key Exchange
Explained in Detail

Understand every step of the BB84 protocol, from key generation to secure message transmission, and how we detect eavesdroppers.

The Complete BB84 Protocol Process

How quantum mechanics enables perfectly secure communication

1

Alice Generates Random Bits & Bases

Alice
0
1
0
1
+
×
+
×

Alice starts by generating:

  • A random sequence of bits (0s and 1s)
  • A random sequence of bases (+ or ×) for each bit

She encodes each bit in the corresponding quantum basis:

  • + basis: 0 → |0⟩, 1 → |1⟩
  • × basis: 0 → |+⟩, 1 → |-⟩
2

Quantum Transmission to Bob

👩🔬
👨🔬

Alice sends the encoded quantum states to Bob through a quantum channel (typically photons in optical fiber):

  • Each quantum state is fragile - any measurement will disturb it
  • The transmission is one-way (Alice→Bob)
  • Quantum no-cloning theorem prevents perfect copying
3

Bob Measures with Random Bases

Bob
+
+
×
+
0
1
0
1

Bob measures each quantum state using randomly chosen bases:

  • When basis matches Alice's: Correct bit result
  • When basis doesn't match: Random 50/50 result

Example outcomes:

Alice's
Bob's
Result
|0⟩ (+)
+
0 (correct)
|1⟩ (+)
×
0 or 1 (random)
|+⟩ (×)
×
0 (correct)
4

Basis Comparison & Key Establishment

+
×
+
×
+
+
×
+
1
3

Alice and Bob publicly compare their bases (not the bits!):

  • They discard all bits where bases didn't match
  • The remaining bits form the raw key
  • About 50% of bits are typically kept

Example with 4 qubits:

Alice's bases: + × + ×

Bob's bases: + + × +

Matching positions: 1, 3 → Keep these bits

5

Eavesdropping Detection

0
1
0
0
🚨
Eve Detected!

To detect eavesdropping:

  • Alice and Bob sacrifice some key bits by comparing them publicly
  • If any bits disagree, Eve must have measured them
  • No errors means either no Eve or she guessed all bases correctly

Security comes from:

  • Quantum uncertainty - Eve can't clone states
  • Randomness - Eve can't predict which bases to use
  • Error detection - Any interference leaves traces
6

Secure Message Transmission

Hello Bob!
1
0
1
1
=
1
0
0
0
1
0
0
0
1
0
1
1
=
Hello Bob!

With a verified secure key, Alice and Bob can communicate:

  • One-Time Pad (XOR): Perfect secrecy when key length ≥ message length
  • AES Encryption: For longer messages with key expansion

XOR Example:

Message:  H    e    l    l    o
ASCII:   01001000 01100101 01101100 01101100 01101111
Key:     01011010 10100101 11010011 00101101 10011010
---------------------------------------------------- XOR
Cipher:  00010010 11000000 10111111 01000001 11110101

Only with the exact same key can Bob decrypt the message.

Frequently Asked Questions

Common questions about quantum key distribution

Why can't Eve copy the quantum states?

+

Due to the quantum no-cloning theorem, it's impossible to create an exact copy of an unknown quantum state. Any attempt by Eve to measure the states will disturb them, revealing her presence when Alice and Bob compare their results.

What happens if Eve intercepts but guesses all bases correctly?

+

If Eve happens to guess all measurement bases correctly (which becomes exponentially unlikely as the key length increases), she could intercept without detection. However, the probability is negligible for practical key lengths (e.g., 1 in 2^100 for 100 bits).

How is this different from classical encryption?

+

Classical encryption (like RSA) relies on computational hardness assumptions that could be broken by quantum computers. QKD's security is based on fundamental physics laws that can't be broken by any computational power.

What practical applications does QKD have?

+

QKD is used for ultra-secure communications in government, military, financial sectors, and any scenario requiring long-term security. Current implementations can work over 100+ km of optical fiber or through free-space satellite links.

Ready to See It in Action?

Experience quantum key distribution firsthand with our interactive simulation.

Launch BB84 Simulation