From 44b1e4e0f8c92a76e8a880ea4c6bb69e910fb9de Mon Sep 17 00:00:00 2001 From: Anand kumar <77325274+Anand2350@users.noreply.github.com> Date: Mon, 25 Oct 2021 11:45:19 +0530 Subject: [PATCH] created encrypt-decrypt.py it is a python program in which u can encrypt and decrypt the username and password of anyone. --- encrypt-decrypt.py | 46 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 46 insertions(+) create mode 100644 encrypt-decrypt.py diff --git a/encrypt-decrypt.py b/encrypt-decrypt.py new file mode 100644 index 0000000..8aa88f1 --- /dev/null +++ b/encrypt-decrypt.py @@ -0,0 +1,46 @@ +count = 0 +while True: + userName = input("\n\nUsername: ") + from getpass import getpass + password =getpass() + count += 1 + if count == 3: + print("Bye!"); + break #The program stops when the user enters the wrong username or password three times + else: + # Change your password and Username + if userName == 'ap' and password == '1234': + + decrypted = b"abcdefghijklmnopqrstuvwxyz!@#$%^&*()1234567890 " + # your own encryption methode + # Importent : Do not write one charactor multiple times + encrypted = b"qmlpoknjiuhbvgytfcxdreszaw3465217809(@)!#*^$%& " + + encrypt_table = bytes.maketrans(decrypted, encrypted) + decrypt_table = bytes.maketrans(encrypted, decrypted) + + + result = '' + choice = '' + message = '' + + while choice != '3': + choice = input("---------------------------------------------------" + "\n Do you want to encrypt or decrypt the message?\n" + " 1. encrypt\n 2. decrypt\n 3. exit program.\n\nchoose: ") + # encryption process + if choice == '1': + message = input('\nEnter message for encryption: ') + result = message.translate(encrypt_table) + print("\n==> " + result + '\n') + + # decryption process + elif choice == '2': + message = input('\nEnter message to decrypt: ') + result = message.translate(decrypt_table) + print("\n==> " + result + '\n') + + elif choice != '3': + print('\n\nIncorrect Choice! \n') + break +