from Crypto.Cipher import AES
from Crypto.Util.Padding import pad
key = b'mysecretpassword' # 16 byte password
cipher = AES.new(key, AES.MODE_CBC)
plaintext = b'my super secret message to encrypt'
ciphertext = cipher.encrypt(pad(plaintext, AES.block_size))
When I print the ciphertext var it displays as follows:
b'\x8e\xde\x02\xa9\x8f8=\x8b\x87\x95\x19f\xcc........
Is there some way I can get this to print out in regular text format?
I tried decode() (latin) that converts to "Ioß×Þ³>Û–ª......."
utf-8 generates an error (0xa9 in position 2: invalid start byte)
End of the day ...I just want the ciphertext in a format similar to "I2XlmXarM6GrX1Qq4p8h3EgnA..."
to compare with ciphertext examples online with the same key, Iv, block mode, text,etc.
Hope all that makes sense.