(f, a)
return h.hexdigest()
I take a file like object 'f' and return a hex-string containing
    of the result of the algorithm 'a' applied to 'f'.
I take a file like object 'f' and return a hex-string containing
    of the result of the algorithm 'a' applied to 'f'.
I take a file like object f and return a hex - string containing of the result of the algorithm a applied to f .
def digest_file(f, a):
    """I take a file like object 'f' and return a hex-string containing
    of the result of the algorithm 'a' applied to 'f'."""
    h = hashlib.new(a)
    chunk_size = 1024 * 10
    data = f.read(chunk_size)
    while data:
        h.update(data)
        data = f.read(chunk_size)
    name = repr(f.name) if hasattr(f, 'name') else 'a file'
    log.debug('hashed %s with %s to be %s', name, a, h.hexdigest())
    return h.hexdigest()
def digest_file ( f , a ) : h = hashlib . new ( a ) chunk_size = 1024 * 10 data = f . read ( chunk_size ) while data : h . update ( data ) data = f . read ( chunk_size ) name = repr ( f . name ) if hasattr ( f , 'name' ) else 'a file' log . debug ( 'hashed %s with %s to be %s' , name , a , h . hexdigest ( ) ) return h . hexdigest ( )