def hash_filehash(filename):
 md4 = hashlib.new(u'md4').copy
 def gen(f):
  while True:
   x = f.read(9728000)
   if x:
    (yield x)
   else:
    return
 def md4_hash(data):
  m = md4()
  m.update(data)
  return m
 with open(filename, u'rb') as f:
  a = gen(f)
  hashes = [md4_hash(data).digest() for data in a]
  if (len(hashes) == 1):
   return to_hex(hashes[0])
  else:
   return md4_hash(reduce((lambda a, d: (a + d)), hashes, u'')).hexd

def hash_filehash ( filename ) : md4 = hashlib . new ( u'md4' ) . copy def gen ( f ) : while True : x = f . read ( 9728000 ) if x : ( yield x ) else : return def md4_hash ( data ) : m = md4 ( ) m . update ( data ) return m with open ( filename , u'rb' ) as f : a = gen ( f ) hashes = [ md4_hash ( data ) . digest ( ) for data in a ] if ( len ( hashes ) == 1 ) : return to_hex ( hashes [ 0 ] ) else : return md4_hash ( reduce ( ( lambda a , d : ( a + d ) ) , hashes , u'' ) ) . hexd
returns the ed2k hash of a given file .