python实现md5和sha1加密
程序员文章站
2024-03-20 09:41:52
...
python的内置库hashlib主要提供 SHA1, SHA224, SHA256, SHA384, SHA512 ,MD5 算法
md5加密
import hashlib
data = 'test'
data2 = '1324tnef微软'
hash_md5 = hashlib.md5(data.encode())
hash_md52 = hashlib.md5(data2.encode())
print(hash_md5.hexdigest())
print(hash_md52.hexdigest())
输出结果为098f6bcd4621d373cade4e832627b4f6 542e5743ac50b847221bca5412f555a7
sha1加密
下一篇: 并查集 判环