我正在尝试使用 PyCrypto 中实现的 DES 算法加密纯文本。但是,当我打印加密文本然后使用生成的加密文本对其进行解密时,似乎每次都会添加一个额外的b。这是一个错误还是我不知道的其他事情?
这是代码示例:
des = DES.new('01234567', DES.MODE_ECB)
text = input('Enter plain text: ')
cipher_text = des.encrypt(text)
print('Cipher Text:' + str(cipher_text))
decipher_text = des.decrypt(ciphertext=cipher_text)
print('Deciphered text is: ' + str(decipher_text))
结果输出:
Enter plain text: abcdefgh
Cipher Text:b'\xec\xc2\x9e\xd9] a\xd0'
Deciphered text is: b'abcdefgh'
b 表示这是一个二进制字符串。
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句