June 16, 2019 re

hashlib means for encrypting the digest algorithm related operations ------

 

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 ' )) # equivalent basis and encrypted hello abc, which is equivalent to the encryption helloabc 
Print (obj.hexdigest ())

 

Guess you like

Origin www.cnblogs.com/python1988/p/11032648.html