MCPcopy Create free account
hub / github.com/Mrinank-Bhowmick/python-beginner-projects / main

Function main

projects/AES256/AES256.py:47–76  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

45
46
47def main():
48 print("\t\tAES 256 Encryption and Decryption Algorithm")
49 print("\t\t-------------------------------------------\n\n")
50 x = input("Enter 1 to encrypt and 2 to decrypt: ")
51 if x == "1":
52 password = input("Enter the Password: ")
53 secret_mssg = input("\nEnter the Secret Message: ")
54
55 # First, let us encrypt the secret message
56 encrypted = encrypt(secret_mssg, password)
57 print("\n\nEncrypted:")
58 print("---------------\n")
59 for k, v in encrypted.items():
60 print(f"{k}: {v}")
61
62 elif x == "2":
63 try:
64 encrypted = {}
65 encrypted["cipher_text"] = input("Enter the cipher text: ")
66 encrypted["salt"] = input("Enter the salt: ")
67 encrypted["nonce"] = input("Enter the nonce: ")
68 encrypted["tag"] = input("Enter the tag: ")
69 password = input("Enter the password: ")
70
71 decrypted = decrypt(encrypted, password)
72 print("\n\nDecrypted:")
73 print("-----------------\n")
74 print(decrypted)
75 except ValueError as e:
76 print(f"Error: {e}")
77
78
79if __name__ == "__main__":

Callers 1

AES256.pyFile · 0.70

Calls 3

itemsMethod · 0.80
encryptFunction · 0.70
decryptFunction · 0.70

Tested by

no test coverage detected