def compute_hash(localfn):
 with open(localfn, u'rb') as f:
  h = hashlib.md5()
  block = f.read(conf.compute_hash_block_size)
  while block:
   h.update(block)
   block = f.read(conf.compute_hash_block_size)
 return h.hexdigest()

def compute_hash ( localfn ) : with open ( localfn , u'rb' ) as f : h = hashlib . md5 ( ) block = f . read ( conf . compute_hash_block_size ) while block : h . update ( block ) block = f . read ( conf . compute_hash_block_size ) return h . hexdigest ( )
computes the md5 hash for a file .