Skip to content

Commit da9c13c

Browse files
Updated Trailing Spaces - e91_qkd.py
1 parent a9467bc commit da9c13c

1 file changed

Lines changed: 3 additions & 4 deletions

File tree

quantum/e91_qkd.py

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

3231
import numpy as np
@@ -51,8 +50,8 @@ def e91_protocol(n_bits: int = 2000) -> dict:
5150
- "key_match": A boolean indicating if Alice's and Bob's keys match.
5251
- "key_length": The final length of the sifted keys.
5352
54-
>>> e91_protocol(100) # doctest: +SKIP
55-
{'alice_key': '1011110', 'bob_key': '1011110', 's_value': 2.73, ...}
53+
>>> e91_protocol(10) # doctest: +SKIP
54+
{'alice_key': '10', 'bob_key': '10', 's_value': 2.0, ...}
5655
5756
>>> e91_protocol(-10)
5857
Traceback (most recent call last):
@@ -169,7 +168,7 @@ def e91_protocol(n_bits: int = 2000) -> dict:
169168
e[key] = np.mean(values) if values else 0.0
170169

171170
# Calculate the S-value: S = e(a,b) - e(a,b') + e(a',b) + e(a',b')
172-
s_value = e["ab"] - e["ab_"] + 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)
173172

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

0 commit comments

Comments
 (0)