def checksum_file(scheme, path):
 h = getattr(hashlib, scheme)()
 with open(path, 'rb') as f:
  chunk = f.read(65535)
  while chunk:
   h.update(chunk)
   chunk = f.read(65535)
 return h.hexdigest()

def checksum_file ( scheme , path ) : h = getattr ( hashlib , scheme ) ( ) with open ( path , 'rb' ) as f : chunk = f . read ( 65535 ) while chunk : h . update ( chunk ) chunk = f . read ( 65535 ) return h . hexdigest ( )
return the checksum of a file .