- Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcipher.py
More file actions
Latest commit
27 lines (23 loc) · 672 Bytes
/
Copy pathcipher.py
File metadata and controls
27 lines (23 loc) · 672 Bytes
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
importrandom
importsys
importgetopt
weyl=13091206342165455529#constant for PRNG
weyl_init=0
plaintext=input("Enter the message to encipher \n")
plaintext_arr=[]
ciphertext_arr=[]
forcharinplaintext:
plaintext_arr.append(ord(char))
print("The plain text is ")
print(plaintext_arr)
number=int(input("Enter a five digit integer key \n"))
seed_number=number
counter=0
defpolynomial(number):
returnnumber**3-3*number+57
foriinrange(0, len(plaintext_arr)):
weyl_init=weyl_init+weyl
number=(polynomial(number)+weyl_init) %100000
ciphertext_arr.append(plaintext_arr[i] ^number)
print("The ciphertext array is ")
print(ciphertext_arr)