SHA256 hash on File via Python
When check hash code of file with python.
import glob
import os
import hashlib
for filename in glob.iglob(os.path.join('.', '*.rar')):
sha256_hash = hashlib.sha256()
print("working on {file}".format(file=filename))
with open(filename, "rb") as f:
for byte_block in iter(lambda: f.read(1024 * 64), b""):
sha256_hash.update(byte_block)
print(">>>> hash : {hash}".format(file=filename, hash=sha256_hash.hexdigest()))
Omitted the detailed description.