Can Quantum Computing Make Key Exchange More Secure? A Simple Look at BB84

Introduction

When we talk about quantum computing and cybersecurity, the conversation often focuses on the threat: sufficiently powerful quantum computers could challenge some of the cryptography we use today.

But quantum technology can also help us secure communications.

One interesting example is Quantum Key Distribution (QKD).

The basic problem QKD tries to address is easy to understand:

How can two computers securely establish a secret key when someone might be listening to the network?

One of the best-known approaches to this problem is BB84, proposed by Charles Bennett and Gilles Brassard in 1984. Quantum Computing in Action introduces BB84 as a way for two parties—traditionally called Alice and Bob—to establish shared secret key material using quantum communication.

You don’t need to understand all of quantum computing to appreciate why BB84 is interesting.

For this article, we only need to understand one unusual characteristic of quantum information.

One Quantum Concept We Need

In a normal computer, information is represented using bits:

0 or 1

Quantum computers use qubits.

Unlike a classical bit, a qubit can exist in a superposition of 0 and 1.

We don’t need to get into the mathematics behind superposition here. The important characteristic for our discussion is:

When we measure a qubit in superposition, the measurement changes its state and the original superposition is lost.

That’s the key idea.

If you want to understand why this happens, there are plenty of resources online, and AI assistants are also a great way to explore concepts such as qubits, superposition, measurement, and quantum gates interactively.

For now, just remember:

Qubit in superposition
↓
Measurement
↓
0 or 1
Original superposition is lost

That strange behavior turns out to be useful for cybersecurity.

The Key Exchange Problem

Suppose Alice wants to communicate securely with Bob.

They could encrypt their messages using a secret key:

Alice Bob
| |
| Encrypted Message |
| --------------------> |
| |
Shared Secret Key

But that creates another problem.

How did Alice and Bob securely exchange the secret key in the first place?

If Alice simply sends the key across the network:

Alice -------- KEY --------> Bob
|
Eve

an attacker—traditionally called Eve—could potentially intercept it.

This is the bootstrap problem discussed in Quantum Computing in Action: if we need a secret key to securely transmit another secret key, how do we establish the first one?

How Classical Computing Handles This

Of course, today’s Internet already has solutions to this problem.

Protocols such as TLS use public-key cryptography and key-agreement techniques to establish secure sessions without simply transmitting a secret session key across the network.

These techniques work extremely well and protect Internet communication every day.

QKD approaches the problem differently.

Instead of relying only on mathematical cryptography, QKD takes advantage of the behavior of quantum information.

And this is where our one quantum concept becomes important.

What If Eve Tries to Listen?

Imagine that Alice sends qubits to Bob.

Some of those qubits are prepared using superposition.

Now Eve wants to intercept them and figure out what Alice is sending.

She has to measure them.

But remember our rule:

Measurement → superposition is lost

So Eve cannot simply look at the quantum information and leave everything untouched.

Her measurement can change the information Bob eventually receives.

Conceptually:

Without Eve
Alice ------ quantum information ------> Bob
With Eve
Alice -----> Eve -----> Bob
|
measures
|
changes quantum
information

That gives Alice and Bob something they don’t normally get from simply transmitting classical bits:

Evidence that someone may have interfered with the key exchange.

This is where the quantum behavior becomes important: if Eve measures qubits prepared in superposition and tries to recreate them, Bob can receive results different from what Alice originally sent.

Enter BB84

BB84 turns this quantum behavior into a key-distribution protocol.

The clever part is that Alice doesn’t prepare every qubit in the same way.

For every bit, she randomly chooses between two different ways of preparing the qubit.

Bob doesn’t know Alice’s choices, so he also randomly chooses how to measure each qubit.

Think of it like Alice randomly choosing between two encoding methods:

Alice:
Bit 1 0 1 1 0 1
Method + X X + X +

Bob independently chooses:

Bob:
Method X X + + X X

After Bob has received and measured everything, Alice and Bob publicly compare which methods they used.

They do not reveal the actual secret bits.

Whenever their methods match, they keep the bit:

Alice: + X X + X +
Bob: X X + + X X
Keep? NO YES NO YES YES NO

The remaining bits can contribute to their shared secret key.

Why Can’t Eve Do the Same Thing?

Because Eve has a timing problem.

When she intercepts a qubit, she doesn’t yet know which method Alice used to prepare it.

She has to guess.

If she guesses incorrectly and measures the qubit, the original quantum state is disturbed.

She can’t simply undo that measurement after Alice later announces which method she used.

It’s already too late.

When Alice and Bob compare a portion of their results, those disturbances can appear as unexpected errors.

Too many errors can indicate that someone interfered with the quantum communication.

That’s the central idea I find fascinating about BB84:

Eavesdropping can leave evidence.

Try BB84 Yourself

Reading about BB84 is one thing. Following a qubit from Alice to Bob—and seeing what changes when Eve intercepts it—makes the idea easier to understand.

To put the theory into practice, I created an interactive BB84 simulator using JavaScript and the quantum-circuit library. It runs directly in your browser, with nothing to install.

Meet the three participants:

  • Alice randomly chooses a bit and a preparation basis—straight (+) or diagonal (×)—for each qubit.
  • Bob independently chooses a basis and measures each arriving qubit.
  • Eve is an optional eavesdropper whose strategy you can choose.

First, try it without Eve

Leave Enable Eve unchecked, choose a qubit count, and click Run new simulation.

The flow diagram shows the direct path from Alice to Bob. Use the arrows in Follow one qubit to inspect Alice’s bit and basis alongside Bob’s basis and measurement.

When their bases match, Bob reads Alice’s bit reliably. When their bases differ, his result is random. Alice and Bob therefore keep only the positions where they chose matching bases.

In this ideal, noiseless simulation, their kept bits always agree when Eve is disabled.

Now, let Eve listen

Check Enable Eve, select Measure Now, and click Run new simulation. The diagram now shows Eve measuring each qubit and resending the state she obtains.

Eve does not know Alice’s basis, so she guesses. When she chooses the wrong basis, her measurement changes the state she sends onward. Bob can then measure a different bit—even when he chooses the same basis as Alice.

Step through the qubits and look for that sequence: Eve chooses the wrong basis, changes the state, and a kept bit may become a mismatch.

Compare the resulting keys

Open See every qubit to inspect which positions were kept or discarded. Below the table, you’ll find Alice’s and Bob’s complete sifted keys: the remaining bits in their original order. Mismatches are highlighted in Bob’s key.

Compare the mismatch count and error rate with Eve off and on. Try a larger qubit count, too. With Eve measuring and resending every qubit, the error rate among kept bits tends toward 25% over many trials. Small runs vary, and some may show no errors at all.

These sifted keys are the endpoint of the measurement demonstration. Real BB84 requires additional steps, including error checking, error correction, and privacy amplification, before producing a final secret key.

What if Eve tries something else?

You can also select Hold Qubit or Copy Qubit and run the scenario.

Holding the qubits leaves Bob waiting, so the exchange cannot proceed to basis announcement. Trying to make a perfect copy reveals another limitation: Eve cannot perfectly copy every possible unknown BB84 state and forward an identical backup to Bob.

Try each strategy and follow where the exchange stops—or where errors can appear.

Measuring in the wrong basis can change a quantum state. The resulting errors give Alice and Bob a way to detect possible interception—although zero errors in a short run does not prove that nobody listened.

The Interesting Part Isn’t Quantum Speed

One thing I especially like about this example is that quantum computing isn’t being used to make something faster.

It’s being used because quantum information behaves differently.

The important property for BB84 is:

Observe quantum information
↓
Measurement affects its state
↓
Interference can create errors
↓
Alice and Bob can detect those errors

That is a very different way of thinking about cybersecurity.

Instead of only making information difficult for an attacker to calculate or decrypt, we can use physics to help reveal that someone tried to observe the key exchange.

Conclusion

Quantum computing can feel intimidating because discussions quickly move into superposition, entanglement, quantum gates, complex numbers, and physics.

But sometimes we can understand why a quantum application matters without understanding all of the mathematics first.

BB84 is a good example.

Start with one quantum characteristic:

Measuring a qubit in superposition changes its state and destroys the original superposition.

Then connect that characteristic to a cybersecurity problem:

If an attacker measures quantum information during a key exchange, that measurement can introduce detectable changes.

And from that simple idea, we can begin to understand why Quantum Key Distribution—and BB84 in particular—is such an interesting application of quantum technology.

For me, that’s one of the best ways to start learning quantum computing:

Don’t start with all the physics. Start with a real problem, understand which quantum characteristic makes a new solution possible, and then explore the technology underneath it.

Leave a comment

About the author

Chung is a seasoned IT expert and Solution Architect with extensive experience in designing innovative solutions, leading technical teams, and securing large-scale contracts. With a strong focus on AI, Large Language Models (LLM), and cloud-based architectures, Chung combines technical expertise with strategic vision to deliver impactful solutions. A technology enthusiast, Chung regularly shares insights on emerging tech trends and practical applications, fostering innovation within the tech community.