Python密码学库cryptography hash 算法使用
安装
pip install cryptography
使用方法
from cryptography.hazmat.primitives import hashes
digest = hashes.Hash(hashes.SHA256())
# digest = hashes.Hash(hashes.SHA3_256())
# digest = hashes.Hash(hashes.SM3())
digest.update(b"abc")
print(digest.finalize())