Python module hashlib implements sha1 and md5 encryption operations
PS: md5 and sha1 are both irreversible
import hashlib
s = "hello fer"
# 实现sha1加密操作
sha1_str = hashlib.sha1(s.encode('utf-8')).hexdigest()
print(f"sha1加密后密文字符串:{sha1_str}")
# 实现md5加密操作
md5_str = hashlib.md5(s.encode("utf-8")).hexdigest()
print(f"md5加密后密文字符串:{md5_str}")
Results of the