1. def Hasher(algorithm, blocksize):
  2.     def hash_file(file):
  3.         hash = algorithm()
  4.         with open(file, 'rb') as f:
  5.             for chunk in iter(lambda: f.read(4096), ''):
  6.                 hash.update(chunk)
  7.         return hash.hexdigest()
  8.     return hash_file