为什么使用用于加密的AES对象解密Pycrypto AES时会产生不同的输出,而仅用于解密的AES对象则会产生正确的输出?
from Crypto.Cipher import AES
obj = AES.new('0123456789012345', AES.MODE_CBC, '0123456789012345')
message = '0123456789012345'
ciphertext = obj.encrypt(message)
plaintext = obj.decrypt(ciphertext)
# plaintext here is byte array
obj2 = AES.new('0123456789012345', AES.MODE_CBC, '0123456789012345')
plaintext = obj2.decrypt(ciphertext)
# plaintext here is 0123456789012345
encrypt
后,obj
的状态是否被重置?否则,初始向量将会不同... - Maarten Bodewes