Skip to content

Commit 50ea388

Browse files
[pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
1 parent da9c13c commit 50ea388

1 file changed

Lines changed: 4 additions & 1 deletion

File tree

quantum/e91_qkd.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@
2626
2727
Reference: https://en.wikipedia.org/wiki/Quantum_key_distribution#E91_protocol:_Artur_Ekert_.281991.29
2828
"""
29+
2930
import random
3031

3132
import numpy as np
@@ -168,7 +169,9 @@ def e91_protocol(n_bits: int = 2000) -> dict:
168169
e[key] = np.mean(values) if values else 0.0
169170

170171
# Calculate the S-value: S = e(a,b) - e(a,b') + e(a',b) + e(a',b')
171-
s_value = e.get("ab", 0.0) - e.get("ab_", 0.0) + e.get("a_b", 0.0) + e.get("a_b_", 0.0)
172+
s_value = (
173+
e.get("ab", 0.0) - e.get("ab_", 0.0) + e.get("a_b", 0.0) + e.get("a_b_", 0.0)
174+
)
172175

173176
# Check for eavesdropper: |S| > 2 indicates security.
174177
eavesdropper_detected = abs(s_value) <= 2

0 commit comments

Comments
 (0)