-
Notifications
You must be signed in to change notification settings - Fork 0
/
Verman.py
42 lines (33 loc) · 805 Bytes
/
Verman.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
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
pt = input("PLAINTEXT:\t")
otp = input("key:\t")
ptList = list()
otpList = list()
uPt = pt.upper()
updatedOtp = otp.upper()
for character1 in uPt:
temp1 = ord(character1) - 65
ptList.append(temp1)
for character2 in updatedOtp:
temp1 = ord(character2) - 65
otpList.append(temp1)
for number in ptList:
if (number < 0):
ptList.remove(number)
for number in otpList:
if (number < 0):
otpList.remove(number)
tempList = [i + j for i, j in zip(ptList, otpList)]
ctList = []
for item in tempList:
if (item > 25):
item -= 26
ctList.append(item)
else:
ctList.append(item)
sadiq = ""
for number in ctList:
number += 65
temp = chr(number)
tempstr = str(temp)
sadiq = sadiq + tempstr
print("CIPHERTEXT:\t", sadiq.lower())