-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathord hw.py
More file actions
32 lines (20 loc) · 846 Bytes
/
ord hw.py
File metadata and controls
32 lines (20 loc) · 846 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
28
29
30
31
32
### Caeser Cipher and Decryptor
decryptList = []
message = input("Type a message to encrypt: ")
key = int(input("What would you like to encrypt by: "))
for i in range(len(message)):
print(chr((ord(message[i]) + key)), end = " ")
message = input("\nMessage to Decrypt: ")
decision = input("\nDo you know what the caeser key is? Y or N\n").upper()
if decision == "Y":
key = int(input("What to decrypt by: "))
for i in range(len(message)):
print(chr((ord(message[i]) - key)), end = " ")
elif decision == "N":
for key in range(1, 27):
for i in range(len(message)):
decryptList.append(chr((ord(message[i]) - key)))
print(chr((ord(message[i]) - key)), end = " ")
for i in decryptList:
with open("wordlist.json", "r") as f:
json.dump(data, f)