-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdecoder.py
More file actions
38 lines (31 loc) · 1.08 KB
/
decoder.py
File metadata and controls
38 lines (31 loc) · 1.08 KB
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
from main import decode
def encode_password(password):
encoded_password = ""
for digit in password:
encoded_digit = str((int(digit) + 3) % 10)
encoded_password += encoded_digit
return encoded_password
def main():
while True:
print()
print("Menu")
print("-------------")
print("1. Encode")
print("2. Decode")
print("3. Quit")
option = input("Please enter an option: ")
if option == "1":
password = input("Please enter your password to encode: ")
encoded_password = encode_password(password)
print("Your password has been encoded and stored!")
elif option == "2":
if 'encoded_password' not in locals():
print("No password has been encoded yet.")
continue
print(f"The encoded password is {encoded_password}, and the original password is {decode_password(encoded_password)}.")
elif option == "3":
break
else:
print("Invalid option")
if __name__ == "__main__":
main()