首先python引用AES加密
from Crypto.Cipher import AES
需要先安装 Crypto 模块, 可以使用 easy_install 进行安装 会自动去官网进行搜索安装
其中代码示例:
aes 加密 需要进行加密数据的处理,要求数据长度必须是16的倍数,不足时,在后边补0
class MyCrypt(): def __init__(self, key): self.key = key self.mode = AES.MODE_CBC def myencrypt(self, text): length = 16 count = len(text) print count if count < length: add = length - count text= text + ('