hashlib模块
1 import hashlib 2 obj = hashlib.sha256() 3 obj.update('admin'.encode('utf-8')) 4 print(obj.hexdigest()) 5 print(len(obj.hexdigest())) 6 输出: 7 8c6976e5b5410415bde908bd4dee15dfb167a9c873fc4bb8a81f6f2ab448a918 8 64
1 import hashlib 2 3 obj = hashlib.md5() 4 obj.update('中国'.encode('utf-8')) 5 print(obj.hexdigest()) 6 输出: 7 c13dceabcb143acd6c9298265d618a9f
可以使用叠加字符串进行加言