解密后的明文前面的b在pycrypto中是什么意思?
What does the b in front of the decrypted plaintext mean in pycrypto?
我正在尝试使用 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表示这是一个二进制字符串。
我正在尝试使用 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表示这是一个二进制字符串。