def md5_hash_for_file(fname):
 with open(fname, 'rb') as f:
  md5sum = md5()
  for block in iter((lambda : f.read(MD5_BLOCK_READ_BYTES)), ''):
   md5sum.update(block)
 return md5sum.hexdigest()

def md5_hash_for_file ( fname ) : with open ( fname , 'rb' ) as f : md5sum = md5 ( ) for block in iter ( ( lambda : f . read ( MD5_BLOCK_READ_BYTES ) ) , '' ) : md5sum . update ( block ) return md5sum . hexdigest ( )
get the md5 checksum of a file .