Skip to content

Commit 4cc981a

Browse files
authored
Add encryption.py
Contains the functions of encryption, to be used later.
1 parent 4957f27 commit 4cc981a

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

password-storage/encryption.py

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
2+
def caesar_cypher(message, key):
3+
'''Encrypts a message using the caesar cypher [WIP]'''
4+
5+
alphabet = ('a','b', 'c', 'd', 'e', 'f', 'g', 'h', 'i' ,'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z')
6+
7+
encrypted = ''
8+
9+
for m in message:
10+
if m.lower() not in alphabet:
11+
encrypted += m
12+
encrypted += alphabet[alphabet.index(m) + key]
13+
14+
return encrypted
15+
16+
17+
print(caesar_cypher('renato', 1))

0 commit comments

Comments
 (0)