I have been working on a class project to write an encryption code in python. I have used AES encryption. But now while creating a graphical interface using Tkinter, I can't print ciphered text as it is in hexadecimal. If anyone knows how to print hexadecimal or bytes in the label widget in Tkinter then please let me know. Thanks.
ciphertext = ciphertext + list(encrypt(plaintext.encode(), key, AES.MODE_ECB))
cipher_label = Label(win, text='Cipher: ' + binascii.hexlify(bytes(ciphertext)))
cipher_label.place(x=80, y=270)
binascii.hexlify(bytes(ciphertext))
returns another bytes
object with the corresponding hexadecimal inside. You're looking for bytes(ciphertext).hex()
to get a string representation.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.