A modular C++23 simulator modelling the BB84 quantum key distribution protocol to generate shared cryptographic keys under realistic conditions and adversary strategies.
- Optical Hardware Models:
- End-to-End Key Generation: Simulates the complete 'QKD lifecycle' from quantum state generation and noisy fibre transmission to basis reconciliation and classical sifting, yielding concrete raw and sifted keys.
- Source Models: Supports both ideal single photon sources and weak coherent pulses (WCP) governed by Poisson statistics.
- Channel Physics: Models exponential fibre attenuation, single photon detector efficiency, optical misalignment error rates, and detector dark counts.
- Adversary Strategies:
- Implements dynamic intercept-resend eavesdropping strategies with optimal interception parameter calculation.
bb84_sim/
├── Makefile
├── .gitignore
├── README.md
├── include/
│ ├── bb84.hpp # Core quantum nodes, hardware configs, and state models
│ └── simulator.hpp # End-to-end pipeline orchestration and metrics
├── src/
│ ├── bb84.cpp # Implementation of quantum generation, transmission, and measurement
│ ├── simulator.cpp # Simulation loop, sifting, and QBER evaluation
│ └── main.cpp # CLI application and performance summary dashboard
└── tests/
├── doctest.h # Single-header testing framework
└── tests.cpp # Automated physics baseline and determinism tests
- A modern C++23 compliant compiler (e.g.,
g++version 13+ or equivalent). makeutility.
- Compile everything and run the test suite:
make- Run the main simulation CLI binary:
make run- Clean up build artefacts:
make cleanThis project is actively under development. Near-term milestones focus on introducing a Photon-Number-Splitting (PNS) attack module, decoy-state methods, classical post-processing pipelines (error correction and privacy amplification), and finite-key security analysis. Long-term objectives include extending the framework to support alternative QKD protocols and multi-hop quantum network simulations.
This project is open-source and is intended for academic use or learning purposes.