Unicode-objects must be encoded before hashing 错误解决办法

Posted jackzz

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了Unicode-objects must be encoded before hashing 错误解决办法相关的知识,希望对你有一定的参考价值。

提交注册用户数据后出来这个,错误原因是update()必须指定要加密的字符串的字符编码

 

 

#encryption
s1 = sha1()
s1.update(upwd.encode("utf8"))
upwd3 = s1.hexdigest()

 

以上是关于Unicode-objects must be encoded before hashing 错误解决办法的主要内容,如果未能解决你的问题,请参考以下文章