Proofs (qkdsec.proofs)
Numerical security proofs for QKD via semidefinite programming.
Requires the proofs extra: pip install qkdsec[proofs].
Example
>>> from qkdsec.proofs import key_rate, BB84, DepolarizingChannel
>>> result = key_rate(BB84(), DepolarizingChannel(qber=0.03))
>>> print(result.r_lower, result.secure)
-
class qkdsec.proofs.BB84[source]
Bases: Protocol
-
dim_a: int = 2
-
dim_b: int = 2
-
key_projectors()[source]
- Return type:
list[ndarray]
-
leakage(channel)[source]
- Return type:
float
- Parameters:
channel (Channel)
-
observables()[source]
- Return type:
dict[str, ndarray]
-
class qkdsec.proofs.Channel[source]
Bases: ABC
-
abstractmethod expectations()[source]
- Return type:
dict[str, float]
-
single_photon_yield()[source]
- Return type:
float
-
total_qber()[source]
- Return type:
float
-
total_yield()[source]
- Return type:
float
-
class qkdsec.proofs.DecoyBounds(Y_0, Y_1_lower, Q_1_lower, e_1_upper)[source]
Bases: object
- Parameters:
-
-
Q_1_lower: float
-
Y_0: float
-
Y_1_lower: float
-
e_1_upper: float
-
class qkdsec.proofs.DecoyChannel(mu_signal, mu_decoy, gain_signal, gain_decoy, gain_vacuum, qber_signal, qber_decoy, e_0=0.5)[source]
Bases: Channel
- Parameters:
-
-
bounds: DecoyBounds
-
e_0: float = 0.5
-
expectations()[source]
- Return type:
dict[str, float]
-
gain_decoy: float
-
gain_signal: float
-
gain_vacuum: float
-
mu_decoy: float
-
mu_signal: float
-
qber_decoy: float
-
qber_signal: float
-
single_photon_yield()[source]
- Return type:
float
-
total_qber()[source]
- Return type:
float
-
total_yield()[source]
- Return type:
float
-
class qkdsec.proofs.DepolarizingChannel(qber)[source]
Bases: Channel
- Parameters:
qber (float)
-
expectations()[source]
- Return type:
dict[str, float]
-
qber: float
-
class qkdsec.proofs.KeyRateResult(r_lower, sdp_status, solve_time_s)[source]
Bases: object
- Parameters:
-
-
r_lower: float
-
sdp_status: str
-
property secure: bool
-
solve_time_s: float
-
class qkdsec.proofs.LossChannel(qber, loss_db)[source]
Bases: Channel
- Parameters:
-
-
expectations()[source]
- Return type:
dict[str, float]
-
loss_db: float
-
qber: float
-
single_photon_yield()[source]
- Return type:
float
-
class qkdsec.proofs.Protocol[source]
Bases: ABC
-
dim_a: int
-
dim_b: int
-
abstractmethod key_projectors()[source]
- Return type:
list[ndarray]
-
abstractmethod leakage(channel)[source]
- Return type:
float
-
abstractmethod observables()[source]
- Return type:
dict[str, ndarray]
-
qkdsec.proofs.key_rate(protocol, channel, *, solver='CLARABEL', n_signals=0, eps_security=1e-10)[source]
- Return type:
KeyRateResult
- Parameters:
-
-
qkdsec.proofs.qber_statistical_inflation(n_detected, eps_security)[source]
- Return type:
float
- Parameters:
-
-
qkdsec.proofs.solve_key_rate_sdp(protocol, channel, solver='CLARABEL')[source]
- Return type:
KeyRateResult
- Parameters:
-
-
qkdsec.proofs.tomamichel_correction(n_detected, eps_security)[source]
- Return type:
float
- Parameters:
-
-
qkdsec.proofs.two_decoy_bounds(mu_signal, mu_decoy, gain_signal, gain_decoy, gain_vacuum, qber_decoy, e_0=0.5)[source]
- Return type:
DecoyBounds
- Parameters:
-