2019年6月16日 re

hashlib 模块 用于加密相关操作——————摘要算法

import hashlib
obj=hashlib.md5()#md5加密
obj2=hashlib.md5('sxj'.encode('utf8'))#md5加严
obj.update('hello'.encode('utf8'))
obj2.update('hello'.encode('utf8'))
print(obj.hexdigest())
print(obj2.hexdigest())

obj.update('abc'.encode('utf-8'))#相当于在hello基础上又加密了abc,也就是等同于加密了helloabc
print(obj.hexdigest())

猜你喜欢

转载自www.cnblogs.com/python1988/p/11032648.html
re