Skip to content

Commit

Permalink
decoder
Browse files Browse the repository at this point in the history
  • Loading branch information
Zacinc05 committed Apr 11, 2024
1 parent 2d1e931 commit fbbeeee
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions nrd_Lab9.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,13 @@ def encode(password):
new_password += str(char)
return new_password

def decode(password):
decoded_password = ""
for char in password:
char = int(char) - 3
decoded_password += str(char)
return decoded_password

def main():
while True:
print("Menu\n-------------\n1. Encode\n2. Decode\n3. Quit")
Expand All @@ -14,6 +21,11 @@ def main():
password = input("Please enter your password to encode: ")
new_pass = encode(password)
print("Your password has been encoded and stored!")
if option == 2:
decoded_password = decode(new_pass)
print(f"The encoded password is {new_pass}, and the original password is {decoded_password}.")
if option == 3:
break

if __name__ == "__main__":
main()

0 comments on commit fbbeeee

Please sign in to comment.