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 message

  • message2 (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 the

  • Otherwise (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 message

  • message2 (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:

CorrectorOutputBase

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 message

  • key – Shared secret key

Returns:

To be communicated message tag: Hash of the message, given the key, with length of the key

Return type:

message

abstract summary()[source]
Calculate a summary object for the error correction containing
  • original message

  • corrected message

  • error rate (before and after correction)

  • number_of_exposed_bits

  • key_reconciliation_rate

  • protocol specific parameters

Return type:

CorrectorOutputBase

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 Alice

  • output_alice (Message) – Corrected message Alice

  • input_bob (Message) – Input message Bob

  • output_bob (Message) – Corrected message Bob

  • input_error (float) – Input error rate

  • output_error (float) – Output error rate

  • output_length (int) – Output message length

  • number_of_exposed_bits (int) – Number of bits exposed in protocol

  • key_reconciliation_rate (float) – Key reconciliation efficiency

  • number_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