Python - File Hashing
Last Updated: 2217Z 13OCT20
(Created: 2217Z 13OCT20)
Examples:
import hashlib
BUF_SIZE = 65536
md5 = hashlib.md5()
with open('path/to/file', 'rb') as fd_in:
while True:
data = fd_in.read(BUF_SIZE)
if not data:
break
md5.update(data)
print('md5: {}'.format(md5.hexdigest()))
# md5: f94a4f3c13d2b75e266226f3644c9a01
References: