I have the following code taken from Pycrypto documentation for my python 2.7 . Here goes the code.
from Crypto.Cipher import AES
from Crypto import Random
key = b'Sixteen byte key'
iv = Random.new().read(AES.block_size)
cipher = AES.new(key, AES.MODE_CFB, iv)
msg = iv + cipher.encrypt(b'Attack at dawn')
print msg
msg2 = cipher.decrypt(msg)
print str(msg2)
I tried to get the output of the msg in Sublime console. All i got is :
[Decode error - output not utf-8]
[Decode error - output not utf-8]
[Finished in 0.2s]
What I'm trying to do is encrypt the message text and view its encryption text in Sublime output and decode the message and view the original text. I tried to use msg.encode('utf-8') but fails giving error like:
UnicodeDecodeError: 'ascii' codec can't decode byte 0x8a in position 5: ordinal not in range(128)
How do i get the texts? Any help.
repr()or in hexadecimal, base64, etc.