qiskit-qkd-lab
A QKD protocol simulator built directly on Qiskit primitives. Circuits run
unchanged on AerSimulator or on real IBM Quantum hardware — including
Eve's eavesdropping, which is implemented as genuine circuit operations
(mid-circuit measurement + reset + conditional re-prep), not a statevector
shortcut.
Installation
pip install qiskit-qkd-lab
Requires Qiskit 2.0 or later. For local development or to run the test suite:
git clone https://github.com/RexRowan/qiskit-qkd-lab.git
cd qiskit-qkd-lab
pip install -e ".[dev]"
pytest
Quick start (Colab)
from qiskit_qkd_lab.protocols import bb84
from qiskit_qkd_lab.channel.eavesdrop import InterceptResend
from qiskit_qkd_lab.diagnostics.qber import estimate_qber, key_rate_report
Or just run examples/demo_bb84.py directly — it's self-contained and
prints a QBER report for clean, fully-intercepted, and partially-intercepted
channels.
See docs/api.md for the full API reference and a runnable
end-to-end example.
Status
This package implements the measurement and diagnostics half of BB84. Implemented so far:
- BB84 prepare/measure circuits (Z/X basis)
- Intercept-resend eavesdropper, circuit-level (mid-circuit measurement)
- Sifting
- QBER estimation via public sample comparison
- Basic key-rate / Eve-detection report
- Test suite + CI (Python 3.10–3.13)
Not yet implemented:
- E91 (entanglement-based) protocol
- Beam-splitting eavesdropper
- Cascade error reconciliation (currently we just sacrifice bits to estimate QBER; there's no actual error-correction step reconciling the retained key yet)
- Privacy amplification (universal hashing)
- Realistic channel noise model (fiber loss / detector dark counts)
- Live diagnostics dashboard (QBER vs. sample size, key rate vs.
distance) — reusing patterns from
qiskit-sqd-dashboard
Because reconciliation and privacy amplification aren't implemented yet, the "final key" this package produces is a sifted, QBER-estimated bit string, not a cryptographically secure key. It's a faithful simulator of BB84's quantum layer and QBER-based eavesdropping detection, useful for teaching and prototyping — treat it accordingly until those pieces land.
See CHANGELOG.md for release history and the roadmap.
Design notes
- Eve's classical register (
eve) is entirely separate from Alice/Bob's shared register (c) — Bob's measurement pipeline never touches it, which is what makes this a faithful "Eve is undetectable except through QBER" model rather than a leak. InterceptResend(p_intercept=...)lets you sweep partial interception to reproduce the textbook QBER-vs-intercept-rate curve, rather than only the full-intercept extreme.n_qubitsin the demo means independent single-photon sends batched into one circuit for simulation speed — no entangling gates between them, so this maps directly onto real hardware qubit count budgets.
Contributing
Contributions are welcome — see CONTRIBUTING.md for
setup instructions, style guidelines, and the design principles this
project tries to hold to. Please note this project follows the
Contributor Covenant.
License
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file qiskit_qkd_lab-0.2.0.tar.gz.
File metadata
- Download URL: qiskit_qkd_lab-0.2.0.tar.gz
- Upload date:
- Size: 9.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/7.0.0 CPython/3.12.1
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
bda0bea60dec58c9ee8bf5db4073f6675490395cf3bc939247cc429664de0948
|
|
| MD5 |
eec9d7ea90a629ebfc7e10920305a109
|
|
| BLAKE2b-256 |
b62c577b119426ddb1009e6fae61e0ce6cebaae99b530761e796955c325114b6
|
File details
Details for the file qiskit_qkd_lab-0.2.0-py3-none-any.whl.
File metadata
- Download URL: qiskit_qkd_lab-0.2.0-py3-none-any.whl
- Upload date:
- Size: 7.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/7.0.0 CPython/3.12.1
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
e265c6a63b9fb1f4b6045751c5485983d9792a627941b0b1212417904beba866
|
|
| MD5 |
5145f1b89e84d908e32168ec929d9f48
|
|
| BLAKE2b-256 |
99c4df23cf778f637402161844e6aebc367592a86250dc3484ea63e8c56be9c5
|