当我输入密码加密一些图像错误出现。类型错误:字符串必须在哈希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)
1条答案
按热度按时间zfycwa2u1#
答:有两种选择。
选择1:
更改此:
致:
备选案文2: