# QKDpy: Quantum Key Distribution Library
[](https://opensource.org/licenses/Apache-2.0)
[](https://www.python.org/downloads/)
[](https://github.com/yourusername/qkdpy/actions/workflows/ci.yml)
[](https://github.com/yourusername/qkdpy/actions/workflows/release.yml)
[](https://qkdpy.readthedocs.io/)
QKDpy is a comprehensive Python library for Quantum Key Distribution (QKD) simulations, implementing various QKD protocols, quantum simulators, and cryptographic tools. It provides an intuitive API similar to NumPy, TensorFlow, and scikit-learn, making quantum cryptography accessible to developers and researchers.
## Features
- **Quantum Simulation**: Simulate qubits, quantum gates, multi-qubit states, and measurements
- **QKD Protocols**: Implementations of BB84, E92, E91, SARG04, CV-QKD, Device-Independent QKD, and more
- **Key Management**: Advanced error correction and privacy amplification algorithms
- **Quantum Cryptography**: Quantum authentication, key exchange, and random number generation
- **Visualization**: Advanced tools to visualize quantum states and protocol execution
- **Quantum Network Analysis**: Tools for analyzing quantum networks and multi-party QKD
- **Extensible Design**: Easy to add new protocols and features
- **Performance**: Efficient implementations for simulations
## Installation
QKDpy requires Python 3.10 or higher. We recommend using [uv](https://github.com/astral-sh/uv) for package management:
```bash
# Install uv
curl -LsSf https://astral.sh/uv/install.sh | sh
# Clone the repository
git clone https://github.com/yourusername/qkdpy.git
cd qkdpy
# Install in development mode
uv pip install -e .
```
## Quick Start
Here's a simple example of using the BB84 protocol to generate a secure key:
```python
from qkdpy import BB84, QuantumChannel
# Create a quantum channel with some noise
channel = QuantumChannel(loss=0.1, noise_model='depolarizing', noise_level=0.05)
# Create a BB84 protocol instance
bb84 = BB84(channel, key_length=100)
# Execute the protocol
results = bb84.execute()
# Print the results
print(f"Generated key: {results['final_key']}")
print(f"QBER: {results['qber']:.4f}")
print(f"Is secure: {results['is_secure']}")
```
For more examples, see the examples directory.
## Advanced Usage
QKDpy also supports advanced protocols and features:
```python
from qkdpy import DeviceIndependentQKD, QuantumKeyManager, QuantumRandomNumberGenerator
# Device-independent QKD
di_qkd = DeviceIndependentQKD(channel, key_length=100)
results = di_qkd.execute()
# Quantum key management
key_manager = QuantumKeyManager(channel)
key_id = key_manager.generate_key("secure_session", key_length=128)
# Quantum random number generation
qrng = QuantumRandomNumberGenerator(channel)
random_bits = qrng.generate_random_bits(100)
```
## Contributing
We welcome contributions! Please see [CONTRIBUTING.md](CONTRIBUTING.md) for guidelines.
## License
QKDpy is licensed under the Apache License 2.0. See [LICENSE](LICENSE) for the full license text.
## Citation
If you use QKDpy in your research, please cite it as described in [CITATION.cff](CITATION.cff).
## Code of Conduct
This project adheres to the Contributor Covenant [code of conduct](CODE_OF_CONDUCT.md). By participating, you are expected to uphold this code.
## Contact
For questions, suggestions, or issues, please open an [issue](https://github.com/yourusername/qkdpy/issues) on GitHub.
Raw data
{
"_id": null,
"home_page": null,
"name": "qkdpy",
"maintainer": null,
"docs_url": null,
"requires_python": ">=3.10",
"maintainer_email": "Pranava-Kumar <pranavakumar.it@gmail.com>",
"keywords": "quantum, cryptography, qkd, simulation",
"author": null,
"author_email": "Pranava-Kumar <pranavakumar.it@gmail.com>",
"download_url": "https://files.pythonhosted.org/packages/81/75/d8febdd2b6fa5aac9157e258e65669565cfc677a84a9f7b9122efb56fdaf/qkdpy-0.2.0.tar.gz",
"platform": null,
"description": "# QKDpy: Quantum Key Distribution Library\n\n[](https://opensource.org/licenses/Apache-2.0)\n[](https://www.python.org/downloads/)\n[](https://github.com/yourusername/qkdpy/actions/workflows/ci.yml)\n[](https://github.com/yourusername/qkdpy/actions/workflows/release.yml)\n[](https://qkdpy.readthedocs.io/)\n\nQKDpy is a comprehensive Python library for Quantum Key Distribution (QKD) simulations, implementing various QKD protocols, quantum simulators, and cryptographic tools. It provides an intuitive API similar to NumPy, TensorFlow, and scikit-learn, making quantum cryptography accessible to developers and researchers.\n\n## Features\n\n- **Quantum Simulation**: Simulate qubits, quantum gates, multi-qubit states, and measurements\n- **QKD Protocols**: Implementations of BB84, E92, E91, SARG04, CV-QKD, Device-Independent QKD, and more\n- **Key Management**: Advanced error correction and privacy amplification algorithms\n- **Quantum Cryptography**: Quantum authentication, key exchange, and random number generation\n- **Visualization**: Advanced tools to visualize quantum states and protocol execution\n- **Quantum Network Analysis**: Tools for analyzing quantum networks and multi-party QKD\n- **Extensible Design**: Easy to add new protocols and features\n- **Performance**: Efficient implementations for simulations\n\n## Installation\n\nQKDpy requires Python 3.10 or higher. We recommend using [uv](https://github.com/astral-sh/uv) for package management:\n\n```bash\n# Install uv\ncurl -LsSf https://astral.sh/uv/install.sh | sh\n\n# Clone the repository\ngit clone https://github.com/yourusername/qkdpy.git\ncd qkdpy\n\n# Install in development mode\nuv pip install -e .\n```\n\n## Quick Start\n\nHere's a simple example of using the BB84 protocol to generate a secure key:\n\n```python\nfrom qkdpy import BB84, QuantumChannel\n\n# Create a quantum channel with some noise\nchannel = QuantumChannel(loss=0.1, noise_model='depolarizing', noise_level=0.05)\n\n# Create a BB84 protocol instance\nbb84 = BB84(channel, key_length=100)\n\n# Execute the protocol\nresults = bb84.execute()\n\n# Print the results\nprint(f\"Generated key: {results['final_key']}\")\nprint(f\"QBER: {results['qber']:.4f}\")\nprint(f\"Is secure: {results['is_secure']}\")\n```\n\nFor more examples, see the examples directory.\n\n## Advanced Usage\n\nQKDpy also supports advanced protocols and features:\n\n```python\nfrom qkdpy import DeviceIndependentQKD, QuantumKeyManager, QuantumRandomNumberGenerator\n\n# Device-independent QKD\ndi_qkd = DeviceIndependentQKD(channel, key_length=100)\nresults = di_qkd.execute()\n\n# Quantum key management\nkey_manager = QuantumKeyManager(channel)\nkey_id = key_manager.generate_key(\"secure_session\", key_length=128)\n\n# Quantum random number generation\nqrng = QuantumRandomNumberGenerator(channel)\nrandom_bits = qrng.generate_random_bits(100)\n```\n\n## Contributing\nWe welcome contributions! Please see [CONTRIBUTING.md](CONTRIBUTING.md) for guidelines.\n\n## License\nQKDpy is licensed under the Apache License 2.0. See [LICENSE](LICENSE) for the full license text.\n\n## Citation\nIf you use QKDpy in your research, please cite it as described in [CITATION.cff](CITATION.cff).\n\n## Code of Conduct\nThis project adheres to the Contributor Covenant [code of conduct](CODE_OF_CONDUCT.md). By participating, you are expected to uphold this code.\n\n## Contact\nFor questions, suggestions, or issues, please open an [issue](https://github.com/yourusername/qkdpy/issues) on GitHub.\n",
"bugtrack_url": null,
"license": "Apache-2.0",
"summary": "A Python Package for Quantum Key Distribution",
"version": "0.2.0",
"project_urls": {
"Bug Tracker": "https://github.com/Pranava-Kumar/qkdpy/issues",
"Homepage": "https://github.com/Pranava-Kumar/qkdpy",
"Repository": "https://github.com/Pranava-Kumar/qkdpy"
},
"split_keywords": [
"quantum",
" cryptography",
" qkd",
" simulation"
],
"urls": [
{
"comment_text": null,
"digests": {
"blake2b_256": "7ff80d84ee89ab11f3fa66ba48fa04c56f1e9726e9b4b1cb3bfdebc916891f26",
"md5": "44ee0adf52910426ed56b12270406e92",
"sha256": "342d098bf4077b2a9adfc25eb18d9bb82d6b0c921fc9851029d40237ff379a61"
},
"downloads": -1,
"filename": "qkdpy-0.2.0-py3-none-any.whl",
"has_sig": false,
"md5_digest": "44ee0adf52910426ed56b12270406e92",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.10",
"size": 81959,
"upload_time": "2025-08-14T07:32:30",
"upload_time_iso_8601": "2025-08-14T07:32:30.009929Z",
"url": "https://files.pythonhosted.org/packages/7f/f8/0d84ee89ab11f3fa66ba48fa04c56f1e9726e9b4b1cb3bfdebc916891f26/qkdpy-0.2.0-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": null,
"digests": {
"blake2b_256": "8175d8febdd2b6fa5aac9157e258e65669565cfc677a84a9f7b9122efb56fdaf",
"md5": "6ac55327c20b9e26be24af6fe8c879f3",
"sha256": "f1fde6d7a1da9ef3d2211a2b111881d12a65acb9a0db632914793d08baf26a75"
},
"downloads": -1,
"filename": "qkdpy-0.2.0.tar.gz",
"has_sig": false,
"md5_digest": "6ac55327c20b9e26be24af6fe8c879f3",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.10",
"size": 63375,
"upload_time": "2025-08-14T07:32:31",
"upload_time_iso_8601": "2025-08-14T07:32:31.458810Z",
"url": "https://files.pythonhosted.org/packages/81/75/d8febdd2b6fa5aac9157e258e65669565cfc677a84a9f7b9122efb56fdaf/qkdpy-0.2.0.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2025-08-14 07:32:31",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "Pranava-Kumar",
"github_project": "qkdpy",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"requirements": [
{
"name": "matplotlib",
"specs": [
[
">=",
"3.7.0"
]
]
},
{
"name": "numpy",
"specs": [
[
">=",
"1.24.0"
]
]
},
{
"name": "scipy",
"specs": [
[
">=",
"1.10.0"
]
]
}
],
"lcname": "qkdpy"
}