首页 > 解决方案 > AES 加密类型错误

问题描述

我需要一个非常简单的算法。我收到此错误消息:raise TypeError("Object type %s cannot be pass to C code" % type(data)) TypeError: Object type cannot be pass to C code

当尝试运行此代码时:

from Crypto.Cipher import AES
import base64

msg_text = 'test some plain text here'.rjust(32)
secret_key = '1234567890123456' 

cipher = AES.new(secret_key,AES.MODE_ECB)
encoded = base64.b64encode(cipher.encrypt(msg_text))

decoded = cipher.decrypt(base64.b64decode(encoded))
print(decoded.strip())

标签: pythonencryptioncryptographyaes

解决方案


推荐阅读