When I enter a password to encrypt some image error appear. Type error: String must be encoded before hashing error
def pass_alert():
messagebox.showinfo("Password Alert","Please enter a password.")
def enc_success(imagename):
messagebox.showinfo("Success","Encrypted Image: " + imagename)
# image encrypt button event
def image_open():
global file_path_e
enc_pass = passg.get()
if enc_pass == "":
pass_alert()
else:
password = hashlib.sha256(enc_pass).digest()
filename = filedialog.askopenfilename()
file_path_e = os.path.dirname(filename)
encrypt(filename,password)
Edit: There are two options.
Option 1:
Change this:
to:
Option 2:.