Skip to content

WIP: Add post processing with error reconciliation and privacy amplification #6

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 12 commits into
base: dev
Choose a base branch
from
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file modified docs/source/_static/all.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified docs/source/_static/error_correction.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
26 changes: 26 additions & 0 deletions docs/source/api/general.md
Original file line number Diff line number Diff line change
@@ -53,4 +53,30 @@
.. automodule:: qosst_core.data
:members:

```

## Extractors

```{eval-rst}
.. automodule:: qosst_core.extractors
:members:
:private-members:

```

## Licenses

```{eval-rst}
.. automodule:: qosst_core.licenses
:members:
:private-members:

```


```{eval-rst}
.. automodule:: qosst_core.licenses.list_licenses
:members:
:private-members:

```
64 changes: 64 additions & 0 deletions docs/source/understanding/configuration.md
Original file line number Diff line number Diff line change
@@ -78,6 +78,10 @@ For most of the section and subsections, if the section or parameter is not pres
| frame.pilots | yes |
| frame.quantum | yes |
| frame.zadoff_chu | yes |
| post_processing | no |
| post_processing.reconciliation | yes |
| post_processing.privacy_amplification | yes |
| pushkey | no |
```

## Parameters in the configuration file
@@ -322,6 +326,19 @@ This should also be 0 for real tests.
Emission schema. The list of possible emission schemas is available [here](../api/schema.md). The schema should be a valid instance of {py:class}`qosst_core.schema.emission.EmissionSchema`.
```

````{py:attribute} override_photon_number
:type: float
:value: 0

If this parameter is not zero, Alice replaces her photon number estimation by this parameter. It is only intended for testing the application with offline data and you should be set to 0 for real experiments.

If not zero, a warning is triggered when the configuration is read.

```{warning}
This should also be 0 for real experiments.
```
````

#### Signal generation

This section holds configuration to load and/or save data during the signal generation algorithm.
@@ -1345,7 +1362,54 @@ If 0 is used, the Zadoff-Chu is emitted at the maximal rate (*i.e.* the rate of
Relative amplitude of the Zadoff-Chu sequence.

An amplitude of 0 means that there is no Zadoff-Chu at the beginning of the frame. An amplitude of 1 means that the Zadoff-Chu is emitted at the maximum voltage of the DAC.
```

### Post processing

This section contains the parameters for the post-processing (error correction and privacy amplification) steps.

#### Reconciliation

```{py:attribute} beta
:type: float
:value: 0.95

Efficiency if the error reconciliation scheme. It should be between 0 and 1.
```

```{py:attribute} dimension
:type: int
:value: 8

Dimension of the multi-dimensional reconciliation scheme. It should be 1, 2, 4 or 8.
```

#### Privacy amplification

```{py:attribute} extractor
:type: str
:value: "qosst_core.extractors.DummyExtractor"

Class of the extractor to use for the privacy amplification. It should be a valid loadable class inheriting from qosst_core.extractors.RandomnessExtractor.
```

### Pushkey

This section contains the parameters for pushing the key material to the KMS at the end of a frame.

```{py:attribute} interface
:type: str
:value: "qosst_core.key_management.default_push_key"

Interface to use to push the key. This should be a callable, taking as a first parameter the UUID of the key material and as a second parameter the key material itself as a bytestring, and eventual additional kwargs.
```

```{py:attribute} kwargs
:type: dict
:value: {}

Eventual kwargs to pass to the interface.
```

## Example configuration file

182 changes: 21 additions & 161 deletions docs/source/understanding/control_protocol.md
Original file line number Diff line number Diff line change
@@ -139,7 +139,7 @@ Here are the messages (variable length header and content that should be issued)

```{code-block} JSON
{
"qosst_version": "QOSST/0.2",
"qosst_version": "QOSST/1.0",
}
```

@@ -613,11 +613,9 @@ No content.

Codes reserved for Error Correction (EC) are 180 to 199.

Bob sends a `EC_INITIALIZATION` with the parameters required for the error correction step. Alice can accept with `EC_READY` or `EC_DENIED`. Alice and Bob will then loop to correct every block with Bob first sending a `EC_BLOCK` and Alice responding `EC_BLOCK_ACK` if the correction worked or `EC_BLOCK_ERROR` if not.
Bob sends a `EC_INITIALIZATION` with the parameters required for the error correction step. Alice tries to perform the error correction and answers either with `EC_VERIFICATION` in case of success (where Alice sends the CRC for Bob to check) or `EC_FAIL`.

At the end of this loop, there might still have some remaining errors and Bob can start another algorithm for correcting those errors with `EC_REMAINING`. Alice answers either with `EC_REMAINING_ACK` if it was successful or `EC_REMAINING_ERROR` if it was not.

At the end, Bob computes the hash of his key and send to Alice with the messages `EC_VERIFICATION`. If the hashes are equal, Alice answers with `EC_VERIFICATION_SUCCESS`, and if not `EC_VERIFICATION_FAIL`.
In case of success at Alice side, Bob then checks the CRC against his own and send the final discard flags to Alice with `EC_DISCARD_FLAGS` and Alice answers with `EC_FINISHED`.


Here is the sequence diagram:
@@ -629,10 +627,6 @@ align: center
Sequence diagram for error correction
```

```{warning}
This part will probably change as the error correction algorithm is still not very defined.
```

### EC_INITIALIZATION

#### Header
@@ -650,12 +644,14 @@ This part will probably change as the error correction algorithm is still not ve

```{code-block} JSON
{
"matrix": [[1,1], [1,1]],
"noise": 0.1,
"channel_message": [0.4784985508658615, -0.05958841748306372],
"syndrome": [[0, 0, 1, 1, 0, 0, 0]],
"normalization_vector": [2.079335585979522, 2.079335585979522, 2.079335585979522],
"signal_to_noise_ratio": -1.98
}
```

### EC_READY
### EC_VERIFICATION

#### Header

@@ -670,9 +666,14 @@ This part will probably change as the error correction algorithm is still not ve

#### Content

No content.
```{code-block} JSON
{
"crc_alice": [[1, 1, 1, 0, 0, 1, 0, 1]],
"discard_flags": [false, true]
}
```

### EC_DENIED
### EC_ERROR

#### Header

@@ -689,11 +690,11 @@ No content.

```{code-block} JSON
{
"error_message": "Matrix is not valid."
"error_message": "normalization vector is not valid."
}
```

### EC_BLOCK
### EC_DISCARD_FLAGS

#### Header

@@ -710,11 +711,11 @@ No content.

```{code-block} JSON
{
"syndrome": [1.87, 5.67,]
{"final_discard_flags": [true, false]}
}
```

### EC_BLOCK_ACK
### EC_FINISHED

#### Header

@@ -731,145 +732,6 @@ No content.

No content.

### EC_BLOCK_ERROR

#### Header

```{code-block} JSON
{
"content_length": 43,
"code": 185,
"challenge": "challenge_requested_by_bob",
"next_challenge": "next_challenge_for_bob"
}
```

#### Content

```{code-block} JSON
{
"error_message": "Wrong syndrome length."
}
```

### EC_REMAINING

#### Header

```{code-block} JSON
{
"content_length": 21,
"code": 186,
"challenge": "challenge_requested_by_alice",
"next_challenge": "next_challenge_for_alice"
}
```

#### Content

```{code-block} JSON
{
"some_parameter": 1,
}
```

### EC_REMAINING_ACK

#### Header

```{code-block} JSON
{
"content_length": 0,
"code": 187,
"challenge": "challenge_requested_by_bob",
"next_challenge": "next_challenge_for_bob"
}
```

#### Content

No content.

### EC_REMAINING_ERROR

#### Header

```{code-block} JSON
{
"content_length": 37,
"code": 188,
"challenge": "challenge_requested_by_bob",
"next_challenge": "next_challenge_for_bob"
}
```

#### Content

```{code-block} JSON
{
"error_message": "Wrong parameter."
}
```

### EC_VERIFICATION

#### Header

```{code-block} JSON
{
"content_length": 28,
"code": 189,
"challenge": "challenge_requested_by_alice",
"next_challenge": "next_challenge_for_alice"
}
```

#### Content

```{code-block} JSON
{
"hash": 385789897481570657,
}
```

### EC_VERIFICATION_SUCCESS

#### Header

```{code-block} JSON
{
"content_length": 0,
"code": 190,
"challenge": "challenge_requested_by_bob",
"next_challenge": "next_challenge_for_bob"
}
```

#### Content

No content.

### EC_VERIFICATION_FAIL

#### Header

```{code-block} JSON
{
"content_length": 40,
"code": 191,
"challenge": "challenge_requested_by_bob",
"next_challenge": "next_challenge_for_bob"
}
```

#### Content

```{code-block} JSON
{
"error_message": "Keys are not equal."
}
```

## Privacy amplification

Codes reserved for Parameters Estimation (PA) are 200 to 219.
@@ -903,9 +765,7 @@ Sequence diagram for privacy amplification
```{code-block} JSON
{
"seed": [1,0,1,1,0],
"secret_key_length": 2000,
"subblock_length": 5,
"feedback_polynomial": [1,1,1,0,0],
"secret_key_ratio": 0.5,
}
```

@@ -943,7 +803,7 @@ No content.

```{code-block} JSON
{
"error_message": "Invalid value for the feedback polynomial."
"error_message": "An error happened during extraction."
}
```

5 changes: 4 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -7,7 +7,10 @@ authors = [
"Ilektra Karakosta-Amarantidou <ilektra.karakostaamarantidou@studenti.unipd.it>",
"Matteo Schiavon <Matteo.Schiavon@lip6.fr>",
]
include = ["qosst_core/configuration/config.example.toml"]
include = [
"qosst_core/configuration/config.example.toml",
"qosst_core/licenses/*.txt",
]
packages = [{ include = "qosst_core" }, { include = "qosst_core/py.typed" }]
license = "GPLv3"
readme = "README.md"
Loading