关于python2.7的md5加密遇到的问题(TypeError: Unicode-objects must be encoded before hashing)

2023-05-16,,

https://blog.csdn.net/u012087740/article/details/48439559

import hashlib
import sys def md5s():
m=hashlib.md5()
strs=sys.argv[1]
m.update(strs.encode("utf8"))
print(m.hexdigest()) if __name__=='__main__': md5s()

注意update()必须指定要加密的字符串的字符编码

关于python2.7的md5加密遇到的问题(TypeError: Unicode-objects must be encoded before hashing)的相关教程结束。

《关于python2.7的md5加密遇到的问题(TypeError: Unicode-objects must be encoded before hashing).doc》

下载本文的Word格式文档,以方便收藏与打印。