import hashlib


def checksum_file(f, blocksize: int = 2 << 15) -> str:
    """
    Checksum a file-like object.
    """
    hasher = hashlib.sha256()
    for block in iter(lambda: f.read(blocksize), b""):
        hasher.update(block)
    f.seek(0)
    return hasher.hexdigest()