(f, h=hashlib.md5, block_size=2 ** 20)
return f_hash
returns the hash of the contents of a file
returns the hash of the contents of a file
returns the hash of the contents of a file
def file_hash(f, h=hashlib.md5, block_size=2 ** 20):
    """returns the hash of the contents of a file"""
    f_hash = h()
    while True:
        buf = f.read(block_size)
        if not buf:
            break
        f_hash.update(buf)

    return f_hash
def file_hash ( f , h = hashlib . md5 , block_size = 2 ** 20 ) : f_hash = h ( ) while True : buf = f . read ( block_size ) if not buf : break f_hash . update ( buf ) return f_hash