MySQL des\u decrypt无法解密由Python加密的字符串

2024-10-01 15:31:10 发布

您现在位置:Python中文网/ 问答频道 /正文

我用des加密字符串,但我想用MySQL解密它。你知道吗

Python包是pycrypto:https://github.com/dlitz/pycrypto

from Crypto.Cipher import DES
import binascii
des_cipher = DES.new(u'password')
print(binascii.hexlify(des_cipher.encrypt(u'11111111')))
print(des_cipher.decrypt(binascii.unhexlify(u'dd3573a56ba157f8')))
>>> dd3573a56ba157f8
>>> 11111111

我尝试了以下查询。但都没用。你知道吗

SELECT des_decrypt(unhex('dd3573a56ba157f8'), 'password');
SELECT cast(des_decrypt(unhex('dd3573a56ba157f8'), 'password') AS VARCHAR(1000));

输出是�5s�k�W�,而不是我想要的11111111。你知道吗


Tags: 字符串httpsimportmysqlpasswordselectcipherprint

热门问题