Skip to content

Commit 82498ab

Browse files
authored
Add files via upload
An encryptor for Caesars Cypher
1 parent a98c446 commit 82498ab

1 file changed

Lines changed: 19 additions & 0 deletions

File tree

CaesarsCypherEncryptor.py

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
def encypt_func(txt, s):
2+
result = ""
3+
4+
for i in range(len(txt)):
5+
char = txt[i]
6+
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+
#Enter here
14+
txt = "Created by Random Demon"
15+
s = 4
16+
17+
print("Plain txt : " + txt)
18+
print("Shift pattern : " + str(s))
19+
print("Cipher: " + encypt_func(txt, s))

0 commit comments

Comments
 (0)