-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.py
29 lines (21 loc) · 886 Bytes
/
main.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
27
from person import Person
if __name__ == "__main__":
q = 353 # prime q
pr = 3 # primite root for prime q
# Create two instances of Person
alice = Person(name="Alice")
bob = Person(name="Bob")
# Generate Key Pairs for the Diffie Hellman Algorithm.
# Private key is generated using a CLCG
alice.generateKeyPairs(q,pr)
bob.generateKeyPairs(q,pr)
# Exchange public keys between users and generate symetric keys
# using each other public key. Both symetric keys should be equal.
alice.generateSymetricKey(bob)
bob.generateSymetricKey(alice)
# Alice sends an encrypted file to Bob
# using RC4 algorithm with the symetric key.
alice.sendFile("input.txt",bob)
# Bob recieves the encrypted file from Alice and decrypts it
# using RC4 algorithm with the symetric key.
bob.decryptFile("encrypted.txt",alice)