qkd_key_rate.protocols.classical.privacy_amplification module

Privacy amplification module.

The PrivacyAmplification class can be used to compute the hash of an error corrected string. The length of the hashed string equals the remaining entropy.

Typical usage example:

from tno.quantum.communication.qkd_key_rate.base import Message
from tno.quantum.communication.qkd_key_rate.protocols.classical.privacy_amplification import (
    PrivacyAmplification,
)

message = Message.random_message(message_length=100)
privacy = PrivacyAmplification(message.length, error_rate_basis_x=0)
entropy = privacy.get_entropy_estimate(error_correction_loss=10)
privacy.do_hash(message, entropy)
class qkd_key_rate.protocols.classical.privacy_amplification.PrivacyAmplification(observed_pulses_basis_x, error_rate_basis_x)[source]

Bases: object

The privacy amplification module. A hash of an error corrected string is computed and returned. The length of the hashed string equals the remaining entropy.

__init__(observed_pulses_basis_x, error_rate_basis_x)[source]
Parameters:
  • observed_pulses_basis_x (int) – Number of pulses received in the X-basis

  • error_rate_basis_x (float) – Error rate in the pulses received in the X-basis

do_hash(message, entropy)[source]

Computes the hash given a message of bits.

The length of the hash equals the secure entropy we have.

Return type:

bytes

get_entropy_estimate(error_correction_loss=0)[source]

Estimate the amount of entropy.

Uses the key-rate estimation functions to determine the key-rate and obtains the number of secure bits by multiplying this by the number of pulses sent. Adjusts the remaining entropy for losses due to the error-correction.

Parameters:

error_correction_loss (int) – Number of corrected errors

Return type:

float

Returns:

The amount of entropy