def file_md5(file_name):
 md5 = hashlib.md5()
 with open(file_name, 'rb') as f:
  for chunk in iter((lambda : f.read((128 * md5.block_size))), ''):
   md5.update(chunk)
 return md5.hexdigest()

def file_md5 ( file_name ) : md5 = hashlib . md5 ( ) with open ( file_name , 'rb' ) as f : for chunk in iter ( ( lambda : f . read ( ( 128 * md5 . block_size ) ) ) , '' ) : md5 . update ( chunk ) return md5 . hexdigest ( )
generate an md5 hash of the specified file .