Skip to content

Commit 81ce6ee

Browse files
Updated e91_qkd.py
1 parent c9b1bf0 commit 81ce6ee

1 file changed

Lines changed: 29 additions & 0 deletions

File tree

quantum/e91_qkd.py

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,32 @@
1+
"""
2+
Implements the E91 quantum key distribution (QKD) protocol.
3+
This protocol uses the principles of quantum entanglement and the violation of
4+
Bell's inequality to securely distribute a secret key
5+
between two parties (Alice and Bob) and to detect
6+
the presence of an eavesdropper (Eve).
7+
8+
How it works:
9+
1. A source (Charlie) generates pairs of entangled qubits in a Bell
10+
state and sends one qubit of each pair to Alice and the other to Bob.
11+
2. Alice and Bob each independently and randomly choose to measure their
12+
incoming qubits in one of three predefined measurement bases.
13+
3. After all measurements are complete, they communicate over a public
14+
channel to compare the bases they chose for each qubit.
15+
4. They divide their measurement results into two sets:
16+
a) Cases where their chosen bases were "compatible" are used to
17+
generate a secret key. Due to entanglement, their results in these
18+
cases should be perfectly correlated.
19+
b) Cases where their bases were "incompatible" are used to test for
20+
eavesdropping by calculating the CHSH inequality parameter 'S'.
21+
5. Quantum mechanics predicts that for an entangled system, |S| can reach
22+
2*sqrt(2) (~2.828), whereas any classical (or eavesdropped) system is
23+
bound by |S| <= 2. If their calculated S-value significantly violates
24+
the classical bound, they can be confident that no eavesdropping
25+
occurred and their generated key is secure.
26+
27+
Reference: https://en.wikipedia.org/wiki/Quantum_key_distribution#E91_protocol:_Artur_Ekert_.281991.29
28+
"""
29+
130
import math
231
import random
332
import numpy as np

0 commit comments

Comments
 (0)