python file hashlib

Solutions on MaxInterview for python file hashlib by the best coders in the world

showing results for - "python file hashlib"
Bruno
05 May 2017
1import hashlib
2BLOCKSIZE = 65536
3hasher = hashlib.md5()
4with open('anotherfile.txt', 'rb') as afile:
5    buf = afile.read(BLOCKSIZE)
6    while len(buf) > 0:
7        hasher.update(buf)
8        buf = afile.read(BLOCKSIZE)
9print(hasher.hexdigest())
10