# TNO-Quantum: QKD key-rate
TNO Quantum provides generic software components aimed at facilitating the development of quantum applications.
The `tno.quantum.communication.qkd_key_rate` package provides python code to compute optimal protocol parameters for different quantum key distribution (QKD) protocols.
The codebase is based on the following papers:
- [Attema et al. - Optimizing the decoy-state BB84 QKD protocol parameters (2021)](https://doi.org/10.1007/s11128-021-03078-0)
- [Ma et al. - Quantum key distribution with entangled photon sources (2007)](http://doi.org/10.1103/PhysRevA.76.012307)
The following quantum protocols are supported:
- BB84 protocol,
- BB84 protocol using a single photon source,
- BBM92 protocol.
The following classical error-correction protocols are supported:
- Cascade,
- Winnow.
The presented code can be used to
- determine optimal parameter settings needed to obtain the maximum key rate,
- correct errors in exchanged sifted keys for the different QKD protocols,
- apply privacy amplification by calculating secure key using hash function.
*Limitations in (end-)use: the content of this software package may solely be used for applications that comply with international export control laws.*
## Documentation
Documentation of the `tno.quantum.communication.qkd_key_rate` package can be found [here](https://tno-quantum.github.io/communication.qkd_key_rate/)
## Install
Easily install the `tno.quantum.communication.qkd_key_rate` package using pip:
```console
$ python -m pip install tno.quantum.communication.qkd_key_rate
```
If you wish to run the tests you can use:
```console
$ python -m pip install tno.quantum.communication.qkd_key_rate[tests]
```
## Usage
<details>
<summary>Compute secure key-rate.</summary>
The following code demonstrates how the BB84 protocol can be used to calculate optimal key-rate for a specific detector.
```python
from tno.quantum.communication.qkd_key_rate.protocols.quantum.bb84 import (
BB84FullyAsymptoticKeyRateEstimate,
)
from tno.quantum.communication.qkd_key_rate.test.conftest import standard_detector
detector = standard_detector.customise(
dark_count_rate=6e-7,
polarization_drift=0.0707,
error_detector=5e-3,
efficiency_detector=0.1,
)
fully_asymptotic_key_rate = BB84FullyAsymptoticKeyRateEstimate(detector=detector)
mu, rate = fully_asymptotic_key_rate.optimize_rate(attenuation=0.2)
```
</details>
<details>
<summary>Correct errors.</summary>
The following example demonstrates usage of the Winnow error correction protocol.
```python
import numpy as np
from tno.quantum.communication.qkd_key_rate.base import Message, Permutations, Schedule
from tno.quantum.communication.qkd_key_rate.protocols.classical.winnow import (
WinnowCorrector,
WinnowReceiver,
WinnowSender,
)
error_rate = 0.05
message_length = 10000
input_message = Message.random_message(message_length=message_length)
error_message = Message(
[x if np.random.rand() > error_rate else 1 - x for x in input_message]
)
schedule = Schedule.schedule_from_error_rate(error_rate=error_rate)
number_of_passes = np.sum(schedule.schedule)
permutations = Permutations.random_permutation(
number_of_passes=number_of_passes, message_size=message_length
)
alice = WinnowSender(
message=input_message, permutations=permutations, schedule=schedule
)
bob = WinnowReceiver(
message=error_message, permutations=permutations, schedule=schedule
)
corrector = WinnowCorrector(alice=alice, bob=bob)
summary = corrector.correct_errors()
```
</details>
# Examples
The [examples](https://github.com/TNO-Quantum/examples) repository contain more elaborate examples that demonstrate possible usage
- How to compute the secure key-rate for various protocols as function of the loss.
![BB84 protocols](https://github.com/TNO-Quantum/communication.qkd_key_rate/raw/main/images/bb84_key_rate.png)
- How to compute secure key-rate using the finite key-rate protocol for different number of pulses.
![Example image](https://github.com/TNO-Quantum/communication.qkd_key_rate/raw/main/images/finite_key_rate.png)
Raw data
{
"_id": null,
"home_page": "https://tno.nl",
"name": "tno.quantum.communication.qkd-key-rate",
"maintainer": "TNO Quantum",
"docs_url": null,
"requires_python": "",
"maintainer_email": "tnoquantum@tno.nl",
"keywords": "TNO,Quantum,Quantum Key Distribution",
"author": "TNO Quantum",
"author_email": "tnoquantum@tno.nl",
"download_url": "https://files.pythonhosted.org/packages/71/db/ad6e01a7f2feec53642bac8784b24025a9ad1faea62e516c06eaeffacd86/tno.quantum.communication.qkd_key_rate-1.0.0.tar.gz",
"platform": "any",
"description": "# TNO-Quantum: QKD key-rate\r\n\r\nTNO Quantum provides generic software components aimed at facilitating the development of quantum applications.\r\n\r\nThe `tno.quantum.communication.qkd_key_rate` package provides python code to compute optimal protocol parameters for different quantum key distribution (QKD) protocols.\r\n\r\nThe codebase is based on the following papers:\r\n\r\n- [Attema et al. - Optimizing the decoy-state BB84 QKD protocol parameters (2021)](https://doi.org/10.1007/s11128-021-03078-0)\r\n- [Ma et al. - Quantum key distribution with entangled photon sources (2007)](http://doi.org/10.1103/PhysRevA.76.012307)\r\n\r\n\r\nThe following quantum protocols are supported:\r\n\r\n- BB84 protocol,\r\n- BB84 protocol using a single photon source,\r\n- BBM92 protocol.\r\n\r\nThe following classical error-correction protocols are supported:\r\n\r\n- Cascade,\r\n- Winnow.\r\n\r\nThe presented code can be used to\r\n\r\n- determine optimal parameter settings needed to obtain the maximum key rate, \r\n- correct errors in exchanged sifted keys for the different QKD protocols,\r\n- apply privacy amplification by calculating secure key using hash function. \r\n\r\n*Limitations in (end-)use: the content of this software package may solely be used for applications that comply with international export control laws.*\r\n\r\n## Documentation\r\n\r\nDocumentation of the `tno.quantum.communication.qkd_key_rate` package can be found [here](https://tno-quantum.github.io/communication.qkd_key_rate/)\r\n\r\n## Install\r\n\r\nEasily install the `tno.quantum.communication.qkd_key_rate` package using pip:\r\n```console\r\n$ python -m pip install tno.quantum.communication.qkd_key_rate\r\n```\r\n\r\nIf you wish to run the tests you can use:\r\n```console\r\n$ python -m pip install tno.quantum.communication.qkd_key_rate[tests]\r\n```\r\n\r\n## Usage\r\n\r\n<details>\r\n <summary>Compute secure key-rate.</summary>\r\nThe following code demonstrates how the BB84 protocol can be used to calculate optimal key-rate for a specific detector.\r\n\r\n```python\r\nfrom tno.quantum.communication.qkd_key_rate.protocols.quantum.bb84 import (\r\n BB84FullyAsymptoticKeyRateEstimate,\r\n)\r\nfrom tno.quantum.communication.qkd_key_rate.test.conftest import standard_detector\r\n\r\ndetector = standard_detector.customise(\r\n dark_count_rate=6e-7,\r\n polarization_drift=0.0707,\r\n error_detector=5e-3,\r\n efficiency_detector=0.1,\r\n)\r\n\r\nfully_asymptotic_key_rate = BB84FullyAsymptoticKeyRateEstimate(detector=detector)\r\nmu, rate = fully_asymptotic_key_rate.optimize_rate(attenuation=0.2)\r\n```\r\n</details>\r\n\r\n<details>\r\n <summary>Correct errors.</summary>\r\nThe following example demonstrates usage of the Winnow error correction protocol.\r\n\r\n```python\r\nimport numpy as np\r\n\r\nfrom tno.quantum.communication.qkd_key_rate.base import Message, Permutations, Schedule\r\nfrom tno.quantum.communication.qkd_key_rate.protocols.classical.winnow import (\r\n WinnowCorrector,\r\n WinnowReceiver,\r\n WinnowSender,\r\n)\r\n\r\nerror_rate = 0.05\r\nmessage_length = 10000\r\ninput_message = Message.random_message(message_length=message_length)\r\nerror_message = Message(\r\n [x if np.random.rand() > error_rate else 1 - x for x in input_message]\r\n)\r\nschedule = Schedule.schedule_from_error_rate(error_rate=error_rate)\r\nnumber_of_passes = np.sum(schedule.schedule)\r\npermutations = Permutations.random_permutation(\r\n number_of_passes=number_of_passes, message_size=message_length\r\n)\r\n\r\nalice = WinnowSender(\r\n message=input_message, permutations=permutations, schedule=schedule\r\n)\r\nbob = WinnowReceiver(\r\n message=error_message, permutations=permutations, schedule=schedule\r\n)\r\ncorrector = WinnowCorrector(alice=alice, bob=bob)\r\nsummary = corrector.correct_errors()\r\n```\r\n</details>\r\n\r\n# Examples\r\nThe [examples](https://github.com/TNO-Quantum/examples) repository contain more elaborate examples that demonstrate possible usage\r\n\r\n- How to compute the secure key-rate for various protocols as function of the loss. \r\n![BB84 protocols](https://github.com/TNO-Quantum/communication.qkd_key_rate/raw/main/images/bb84_key_rate.png)\r\n\r\n- How to compute secure key-rate using the finite key-rate protocol for different number of pulses.\r\n![Example image](https://github.com/TNO-Quantum/communication.qkd_key_rate/raw/main/images/finite_key_rate.png)\r\n",
"bugtrack_url": null,
"license": "Apache License, Version 2.0",
"summary": "Quantum communication key-rate modules",
"version": "1.0.0",
"project_urls": {
"Documentation": "https://tno-quantum.github.io/communication.qkd_key_rate/",
"Download": "https://pypi.org/project/tno.quantum.communication.qkd_key_rate/#files",
"Homepage": "https://tno.nl",
"Source Code": "https://github.com/TNO-Quantum/communication.qkd_key_rate"
},
"split_keywords": [
"tno",
"quantum",
"quantum key distribution"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "7a2ee593b7577ba695f4d9b19f6cd0a5d4e6e421713e31f993ccb22d64ece5f0",
"md5": "9ec2bcd4b97c68bc683233d816d18992",
"sha256": "aaace6274f291d424711b6e1dba275c53b572fe43e0492cc70f0b2e024ea2484"
},
"downloads": -1,
"filename": "tno.quantum.communication.qkd_key_rate-1.0.0-py3-none-any.whl",
"has_sig": false,
"md5_digest": "9ec2bcd4b97c68bc683233d816d18992",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": null,
"size": 66914,
"upload_time": "2023-07-05T14:22:33",
"upload_time_iso_8601": "2023-07-05T14:22:33.373735Z",
"url": "https://files.pythonhosted.org/packages/7a/2e/e593b7577ba695f4d9b19f6cd0a5d4e6e421713e31f993ccb22d64ece5f0/tno.quantum.communication.qkd_key_rate-1.0.0-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "71dbad6e01a7f2feec53642bac8784b24025a9ad1faea62e516c06eaeffacd86",
"md5": "8a2090dbde1003826a24b211cdb9747d",
"sha256": "834815b1cb57e4b188ced3c0b20f98955986012814737765a23b30a5038d6ad5"
},
"downloads": -1,
"filename": "tno.quantum.communication.qkd_key_rate-1.0.0.tar.gz",
"has_sig": false,
"md5_digest": "8a2090dbde1003826a24b211cdb9747d",
"packagetype": "sdist",
"python_version": "source",
"requires_python": null,
"size": 48794,
"upload_time": "2023-07-05T14:22:35",
"upload_time_iso_8601": "2023-07-05T14:22:35.439664Z",
"url": "https://files.pythonhosted.org/packages/71/db/ad6e01a7f2feec53642bac8784b24025a9ad1faea62e516c06eaeffacd86/tno.quantum.communication.qkd_key_rate-1.0.0.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2023-07-05 14:22:35",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "TNO-Quantum",
"github_project": "communication.qkd_key_rate",
"travis_ci": false,
"coveralls": false,
"github_actions": false,
"lcname": "tno.quantum.communication.qkd-key-rate"
}