美文网首页
python文件hash

python文件hash

作者: 慢慢没发现 | 来源:发表于2021-10-07 11:27 被阅读0次
import hashlib
def CalcFileSha256(filname):
''' calculate file sha256 '''
    with open(filname, "rb")as f:
        sha256obj = hashlib.sha256()
        sha256obj.update(f.read())
        hash_value = sha256obj.hexdigest()
        return hash_value
file ="D:\part0001"#文件分块位置
print(CalcFileSha256(file))

相关文章

网友评论

      本文标题:python文件hash

      本文链接:https://www.haomeiwen.com/subject/leaanltx.html