This project is a hands-on simulation of the BB84 Quantum Key Distribution (QKD) protocol using Qiskit.
If you're curious about how quantum mechanics can be used to share encryption keys securely, this repository gives you a clean and easy-to-follow implementation of the entire process β from qubit preparation all the way to detecting an attacker.
Classical encryption depends heavily on math problems that might become breakable with future quantum computers.
BB84 is different β it builds security using physics, not assumptions.
I built this simulation to show:
- How a secret key can be created using qubits
- How noise or interception affects the communication
- How QBER (Quantum Bit Error Rate) can reveal an attacker
- That QKD is surprisingly simple once broken down into steps
If you're new to quantum computing, this project gives you an intuitive starting point.
Imagine two users β a Quantum Sender and a Quantum Receiver β trying to agree on a secret encryption key.
- The Sender creates random bits.
- They encode each bit into a qubit using a random basis (
+orx). - The Receiver measures each qubit using their own random basis.
- Both sides publicly compare which bases they used (but not the bits!).
- Bits where they used the same basis become part of the sifted key.
- A small sample of the key is compared to calculate QBER.
- If QBER is too high, it means someone tried to intercept the qubits.
No attacker can hide, because in quantum mechanics measuring a qubit disturbs it.
- Random qubit generation (0 or 1)
- Random basis selection (
+orx) - Qiskit-based qubit preparation
- Receiver measurement
- Optional noise and interception
- Automatic QBER calculation
- Cleanly formatted output summary
- Two visual graphs:
- Effect of Noise on QBER
- QBER With vs Without Interception
Everything is kept readable and beginner-friendly.