func (sb *SectorBuilder) Finish() *[renterhost.SectorSize]byte {
	frand.Read(sb.sector[sb.sectorLen:])
	sb.sectorLen = len(sb.sector)
	return &sb.sector
}
Finish fills the remaining capacity of the sector with random bytes and
returns it.

After calling Finish, Len returns renterhost.SectorSize and Remaining
returns 0; no more data can be appended until Reset is called.

Finish returns a pointer to sb's internal buffer, so the standard warnings
regarding such pointers apply. In particular, the pointer should not be
retained after Reset is called.
package renter
import (
	"errors"
	"fmt"
	"go.sia.tech/siad/crypto"
	"go.sia.tech/siad/types"
	"lukechampine.com/frand"
	"lukechampine.com/us/hostdb"
	"lukechampine.com/us/merkle"
	"lukechampine.com/us/renter/proto"
	"lukechampine.com/us/renterhost"
)
type SectorBuilder struct {
	sector    [renterhost.SectorSize]byte
	sectorLen int
	slices    []SectorSlice
}
func (sb *SectorBuilder) Reset() {
	sb.sectorLen = 0
	sb.slices = nil  
}
func (sb *SectorBuilder) SliceForAppend() []byte {
	return sb.sector[sb.sectorLen:]
}
func (sb *SectorBuilder) Append(data []byte, key KeySeed, nonce [24]byte) int {
	if len(data)%merkle.SegmentSize != 0 {
		panic("len(data) must be a multiple of merkle.SegmentSize bytes")
	}
	if sb.sectorLen+len(data) > renterhost.SectorSize {
		panic("data exceeds sector size")
	}
	sectorSlice := sb.sector[sb.sectorLen:][:len(data)]
	copy(sectorSlice, data)
	segmentIndex := sb.sectorLen / merkle.SegmentSize
	key.XORKeyStream(sectorSlice, nonce[:], uint64(segmentIndex))
	sb.slices = append(sb.slices, SectorSlice{
		SegmentIndex: uint32(segmentIndex),
		NumSegments:  uint32(len(sectorSlice) / merkle.SegmentSize),
		Nonce:        nonce,
	})
	sb.sectorLen += len(sectorSlice)
	return len(sb.slices) - 1
}
func (sb *SectorBuilder) Len() int {
	return sb.sectorLen
}
func (sb *SectorBuilder) Remaining() int {
	return len(sb.sector) - sb.sectorLen
}