def Md5ForFile(f):
 md5 = hashlib.md5()
 if os.path.isfile(f):
  with open(f, 'rb') as f:
   for chunk in iter((lambda : f.read((128 * md5.block_size))), ''):
    md5.update(chunk)
 else:
  return '0'
 return md5.digest()

def Md5ForFile ( f ) : md5 = hashlib . md5 ( ) if os . path . isfile ( f ) : with open ( f , 'rb' ) as f : for chunk in iter ( ( lambda : f . read ( ( 128 * md5 . block_size ) ) ) , '' ) : md5 . update ( chunk ) else : return '0' return md5 . digest ( )
return an md5 hash of the specified file .