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
Metadata
Release files for qiskit-qkd-lab 0.2.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| qiskit_qkd_lab-0.2.0.tar.gz | 9.6 kB | Without provenance | Details for qiskit_qkd_lab-0.2.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| qiskit_qkd_lab-0.2.0-py3-none-any.whl | Python 3 | none | any | Details for qiskit_qkd_lab-0.2.0-py3-none-any.whl |
Total release size: 17.6 kB
Release files / qiskit_qkd_lab-0.2.0.tar.gz
| Download URL | qiskit_qkd_lab-0.2.0.tar.gz |
|---|---|
| Size | 9.6 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
bda0bea60dec58c9ee8bf5db4073f6675490395cf3bc939247cc429664de0948
|
|
BLAKE2b-256 checksum How to use checksums |
b62c577b119426ddb1009e6fae61e0ce6cebaae99b530761e796955c325114b6
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.12.1
|
Release files / qiskit_qkd_lab-0.2.0-py3-none-any.whl
| Download URL | qiskit_qkd_lab-0.2.0-py3-none-any.whl |
|---|---|
| Size | 7.9 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
e265c6a63b9fb1f4b6045751c5485983d9792a627941b0b1212417904beba866
|
|
BLAKE2b-256 checksum How to use checksums |
99c4df23cf778f637402161844e6aebc367592a86250dc3484ea63e8c56be9c5
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.12.1
|
Security for qiskit-qkd-lab 0.2.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.