编程语言
首页 > 编程语言> > 38、python模块学习-hashlib学习

38、python模块学习-hashlib学习

作者:互联网

#!/usr/bin/env python
#__author: hlc
#date: 2019/6/8

# import hashlib
# m = hashlib.md5()
# m.update("hello".encode("utf-8"))
# print(m.hexdigest()) # 5d41402abc4b2a76b9719d911017c592;十六进制
# m.update("asd".encode("utf-8"))
# print(m.hexdigest()) # 0e8c61b99af502b3e655015816057f81
# 拼接之后等价于
# m2 = hashlib.md5()
# m2.update("helloasd".encode("utf-8"))
# print(m2.hexdigest()) # 0e8c61b99af502b3e655015816057f81

# m3 = hashlib.sha256()
# m3.update("helloasd".encode("utf-8"))
# print(m3.hexdigest()) # dba6c85fa439f90f87a545b525f2c1c5db3ba6144e19fa49b83a28ceb844448d

  

标签:hashlib,38,utf,python,update,hexdigest,encode,print
来源: https://www.cnblogs.com/hlc-123/p/10989980.html