@classmethod
def update_hash(cls, filelike, digest):
    """Update the digest of a single file in a memory-efficient manner."""
    block_size = digest.block_size * 1024
    for chunk in iter(lambda : filelike.read(block_size), b''):
        digest.update(chunk)
