-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathapp.py
26 lines (19 loc) · 764 Bytes
/
app.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
import config
from protocols import bb84, b92, ekert91, quantum_teleportation
from utils import error_correction, key_exchange, quantum_channel
def main():
config = config.config
alice_key = np.random.randint(0, 2, size=1024)
bob_key = np.random.randint(0, 2, size=1024)
# Quantum key distribution
shared_key = bb84_protocol(alice_key, bob_key)
# Error correction
corrected_key = error_correction.reed_solomon_error_correction(shared_key, 256)
# Key exchange
shared_key = key_exchange(corrected_key, bob_key)
# Quantum teleportation
teleported_key = quantum_teleportation(shared_key, bob_key)
print("Shared Key:", shared_key)
print("Teleported Key:", teleported_key)
if __name__ == "__main__":
main()