qkd_key_rate.base.corrector module
Base class for error corrector objects.
- class qkd_key_rate.base.corrector.Corrector(alice, bob)[source]
Bases:
object
Error corrector base class.
- __init__(alice, bob)[source]
Base class for error correcting
- Parameters:
Alice – The sending party
Bob – The receiving party
- static calculate_error_rate(message1, message2)[source]
Calculate the error rate between two messages.
If messages differ in length, the number of errors is calculated using the number of bits of the shortest message.
- Parameters:
message1 (
Message
) – First messagemessage2 (
Message
) – Second message
- Returns:
Ratio of errors over the message length.
- Return type:
error_rate
- calculate_key_reconciliation_rate(exposed_bits=False)[source]
Calculate the key reconciliation rate.
- Parameters:
exposed_bits (
bool
) – If true, uses the number of exposed bits to compute theOtherwise (key-reconciliation rate.) –
and (uses the ratio between the in-) –
length. (output message) –
- Returns:
The reconciliation rate
- Return type:
key_rate
- static calculate_number_of_errors(message1, message2)[source]
Calculate the error rate between two messages If messages differ in length, the number of errors is calculated using the number of bits of the shortest message.
- Parameters:
message1 (
Message
) – First messagemessage2 (
Message
) – Second message
- Returns:
Number of errors.
- Return type:
number_of_errors
- correct_errors(detail_transcript=False)[source]
Receiver Bob corrects the errors based on Alice her message.
- Parameters:
detail_transcript (
Optional
[bool
]) – Whether to print a detailed transcript- Return type:
- static create_message_tag_pair(message, shared_key)[source]
Prepares a message-tag hashed pair.
The message can be communicated publicly. The tag is the hash of the message, given a key.
- Parameters:
message (
Message
) – To be communicated messagekey – Shared secret key
- Returns:
To be communicated message tag: Hash of the message, given the key, with length of the key
- Return type:
message
- class qkd_key_rate.base.corrector.CorrectorOutputBase(input_alice, output_alice, input_bob, output_bob, input_error, output_error, output_length, number_of_exposed_bits, key_reconciliation_rate, number_of_communication_rounds)[source]
Bases:
object
Base class corrector summary object
- Parameters:
input_alice (
Message
) – Input message Aliceoutput_alice (
Message
) – Corrected message Aliceinput_bob (
Message
) – Input message Boboutput_bob (
Message
) – Corrected message Bobinput_error (
float
) – Input error rateoutput_error (
float
) – Output error rateoutput_length (
int
) – Output message lengthnumber_of_exposed_bits (
int
) – Number of bits exposed in protocolkey_reconciliation_rate (
float
) – Key reconciliation efficiencynumber_of_communication_rounds (
int
) – Number of communication rounds
- input_alice: Message
- input_bob: Message
- input_error: float
- key_reconciliation_rate: float
- number_of_communication_rounds: int
- number_of_exposed_bits: int
- output_alice: Message
- output_bob: Message
- output_error: float
- output_length: int