Skip to content

Commit 7a87c76

Browse files
authored
Add files via upload
Decryptor
1 parent f17ee9e commit 7a87c76

1 file changed

Lines changed: 22 additions & 0 deletions

File tree

CaesarsCypherDecryptor.py

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
import time
2+
3+
def encypt_func(txt, s):
4+
result = ""
5+
for i in range(len(txt)):
6+
char = txt[i]
7+
if (char.isupper()):
8+
result += chr((ord(char) + s - 64) % 26 + 65)
9+
else:
10+
result += chr((ord(char) + s - 96) % 26 + 97)
11+
return result
12+
13+
txt = input("What would you like to decrypt?")
14+
s = 20
15+
16+
time.sleep(1)
17+
print("Plain txt : " + txt)
18+
time.sleep(1)
19+
print("Shift pattern : " + str(s))
20+
time.sleep(1)
21+
print("Cipher: " + encypt_func(txt, s))
22+
time.sleep(3)

0 commit comments

Comments
 (0)