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))
网友评论