import hashlib
# import md5 #python2里面
#md5
# password='abc123abc123abc123abc123abc123abc123abc123abc123abc123abc123'
# # print(password.encode()) #bytes
# m = hashlib.md5(password.encode())
# print(m.hexdigest())
#md5加密是不可逆的
#撞库
#123456 e99a18c428cb38d5f260853678922e03
#abc123 e99a18c428cb38d5f260853678922e03
#123321 e99a18c428cb3815f260853678922e03
#123456789 e99a18c428cb3815f220853678922e03
# f = open('PyMySQL-0.9.3.tar.gz','rb')
# content = f.read()
# sha = hashlib.sha256(content)
#加盐
def my_md5(content,salt='SFG@#!@#$!'):
s = str(content) + salt
m = hashlib.md5(s.encode())
return m.hexdigest()
转载于:https://www.cnblogs.com/Dorami/p/11098674.html