from Crypto.Cipher import AES import base64 data=bytes('amit1996','utf-8') key = b'1234567890123456' cipher = AES.new(key, AES.MODE_EAX) ciphertext = cipher.encrypt(data) nonce=cipher.nonce print(ciphertext) print(nonce) tr=base64.b64encode(nonce) print(base64.b64decode(b'PG3FofMUKfbx+KKimwk2hA==')) print(base64.b64encode(ciphertext)) cipher = AES.new(key, AES.MODE_EAX, nonce) data = cipher.decrypt(ciphertext) print(data)