def appendixB(): printBanner() print("\n***********************************************\n" + "Using Encrypt.py to encrypt the input given\n" + "in AppendixB. The result is tested against the\n" + "desired result listed in AppendixB of FIPS197\n" + "for validation.\n\n" + "Would you like to see the datapath between\n" + "rounds? You may compare state as desired\n" + "this way to what is listed in AppendixB.\n" + "***********************************************") demoPlainTxt = "3243f6a8885a308d313198a2e0370734" demoKey = "2b7e151628aed2a6abf7158809cf4f3c" ans = input( "Enter Y to see state changes,\nor return to just see the result: ") if ans.lower() == "y": encrypt = Encrypt(demoPlainTxt, demoKey, printMode=GRID) else: encrypt = Encrypt(demoPlainTxt, demoKey, printMode=OFF) result = encrypt.result appendixBResult = "3925841d02dc09fbdc118597196a0b32" print("***********************************************") print(f"Result matches FIPS197: {result == appendixBResult}") print("***********************************************")
def customDecrypt(): printBanner() print("\n***********************************************\n" + "Using Decrypt.py to decrypt the your input\n" + "***********************************************") print("Enter Ciphertext:F4351503AA781C520267D690C42D1F43") print(" Enter Key:303132333435363738393A3B3C3D3E3F") demoPlainTxt = "F4351503AA781C520267D690C42D1F43" demoKey = "303132333435363738393A3B3C3D3E3F" decrypt = Decrypt(demoPlainTxt, demoKey, printMode=CMODE) result = decrypt.result print("***********************************************") print(f"Result: {result}") print("***********************************************")
def appendixC(): printBanner() print("\n***********************************************\n" + "Using Decrypt.py to decrypt the input given\n" + "in AppendixC. The state is tested against the\n" + "state in AppendixC of FIPS197 for\n" + "for validation.\n" + "***********************************************") demoPlainTxt = "69c4e0d86a7b0430d8cdb78070b4c55a" demoKey = "000102030405060708090a0b0c0d0e0f" input("Press return to start: ") decrypt = Decrypt(demoPlainTxt, demoKey, printMode=CMODE) result = decrypt.result appendixCResult = "00112233445566778899aabbccddeeff" print("***********************************************") print(f"Result matches FIPS197: {result == appendixCResult}") print("***********************************************")
def customDecrypt(): printBanner() print("\n***********************************************\n" + "Using Decrypt.py to decrypt your input\n" + "***********************************************") demoPlainTxt = input("Enter Ciphertext:") demoKey = input(" Enter Key:") while len(demoPlainTxt) != 32 or len(demoKey) != 32: print("please make sure both inputs are 16 bytes of hex") demoPlainTxt = input("Enter PlainTxt:") demoKey = input(" Enter Key:") decrypt = Decrypt(demoPlainTxt, demoKey, printMode=CMODE) result = decrypt.result print("***********************************************") print(f"Result: {result}") print("***********************************************")