'''
hashlib模块提供了很多加密的算法
'''

import hashlib

def hashlib_encode():
salt = '321321'
content = "admin"
md5 = hashlib.md5(bytes(salt,encoding='utf8'))
md5.update(bytes(content,encoding='utf-8'))
# d8823982474b60c7bdc2f4ee87b1cf2b
# md5 = hashlib.md5()
# md5.update(bytes(salt+content,encoding='utf8'))
# d8823982474b60c7bdc2f4ee87b1cf2b
result = md5.hexdigest()
print(result)
if __name__ == '__main__':
hashlib_encode()
pass
posted on 2019-07-02 21:18  天0涯  阅读(144)  评论(0编辑  收藏  举报