def calculate_file_checksum(path):
 hasher = hashlib.md5()
 with io.FileIO(path, 'r') as fp:
  while True:
   buf = fp.read(65536)
   if (not buf):
    break
   hasher.update(buf)
 return hasher.hexdigest()

def calculate_file_checksum ( path ) : hasher = hashlib . md5 ( ) with io . FileIO ( path , 'r' ) as fp : while True : buf = fp . read ( 65536 ) if ( not buf ) : break hasher . update ( buf ) return hasher . hexdigest ( )
calculate the md5 sum for a file: read chunks of a file and update the hasher .