Python 哈希散列算法

# 导入算法库模块
import hashlib
# 准备需要加密的数据(二进制)
password = "d979879r573495983479799das9f89a8df987d98v9vu988"
# 转换为而二进制
password = password.encode("utf-8")
# 检查软件的md5
fp = open("./01 变量的命名空间和作用域.py", "rb")
data = fp.read()
fp.close()

# 创建算法对象
hash = hashlib.sha256(data)
# 获取加密结果
res = hash.hexdigest()
print(res)

猜你喜欢

转载自blog.csdn.net/qq_39286483/article/details/103900131