from Crypto.Cipher import AES k=0x4645444342413938373635343332310a m=0x97B3C8E55AEBAD9B9A802AC020272BCE key=(k).to_bytes(16, byteorder='big') msg=(m).to_bytes(16, byteorder='big') obj = AES.new(key, AES.MODE_ECB) enc = obj.encrypt(msg) dec = obj.decrypt(enc) print("ENC=" + ''.join(['{:02x}'.format(i) for i in enc])) print("DEC=" + ''.join(['{:02x}'.format(i) for i in dec]))