import hashlib


def get_fd_hash(fd):
    """
    Compute the sha256 hash of the bytes in a file-like
    """
    BLOCKSIZE = 1 << 16
    hasher = hashlib.sha256()
    old_pos = fd.tell()
    fd.seek(0)
    buf = fd.read(BLOCKSIZE)
    while buf:
        hasher.update(buf)
        buf = fd.read(BLOCKSIZE)
    fd.seek(old_pos)
    return hasher.hexdigest()