pip3 install pycrypto pip3 install pycryptodome 带位置偏移 b’0123456789’
def decrypt(text, key, mode):
cryptor = AES.new(key, mode, b'0123456789')
plain_text = cryptor.decrypt(base64.b64decode(text))
print(plain_text.decode('utf8'))
return plain_text
if __name__ == '__main__':
import base64
from Crypto.Cipher import AES
from binascii import b2a_hex, a2b_hex
key = b'asfhjasffa'
mode = AES.MODE_CBC
t = '要解密的字符串'
a = a2b_hex(t)
i = base64.b64encode(a)
decrypt(i, key, mode)
来源:https://blog.csdn.net/weixin_42705077/article/details/100572250
|