我跟踪了这个链接link,它正在处理我认为是错误的东西。这是我解密加密字符串时得到的输出。我无法复制,所以这是图像:
它应该解密为mYs3cr3t!字符串。在
编辑,这里是我的代码:def encrypt(self,param):
BLOCK_SIZE = 16
PADDING = '{'
pad = lambda s: s + (BLOCK_SIZE - len(s) % BLOCK_SIZE) * PADDING
EncodeAES = lambda c, s: base64.b64encode(c.encrypt(pad(s)))
secret = "mynotsosecretkey"
print 'encryption key:',secret
cipher = AES.new(secret)
encoded = EncodeAES(cipher, param)
print 'Encrypted string:', encoded
return (encoded,secret)
def decryption(self,passwd):
PADDING = '{'
DecodeAES = lambda c, e: c.decrypt(base64.b64decode(e)).rstrip(PADDING)
encryption,key = self.encrypt(passwd)
cipher = AES.new(key)
decoded = DecodeAES(cipher, encryption)
print decoded
至于输出,我无法复制它,因为它包含一些奇怪的字符。在