func deriveKey(masterKey crypto.TwofishKey, chunkIndex, pieceIndex uint64) crypto.TwofishKey {
	return crypto.TwofishKey(crypto.HashAll(masterKey, chunkIndex, pieceIndex))
}
deriveKey derives the key used to encrypt and decrypt a specific file piece.
package renter
import (
	"errors"
	"fmt"
	"math"
	"os"
	"path/filepath"
	"sync"
	"github.com/NebulousLabs/Sia/build"
	"github.com/NebulousLabs/Sia/crypto"
	"github.com/NebulousLabs/Sia/modules"
	"github.com/NebulousLabs/Sia/persist"
	"github.com/NebulousLabs/Sia/types"
)
var (
	ErrEmptyFilename = errors.New("filename must be a nonempty string")
	ErrPathOverload = errors.New("a file already exists at that location")
	ErrUnknownPath = errors.New("no file known with that path")
)
type file struct {
	name        string
	size        uint64  
	contracts   map[types.FileContractID]fileContract
	masterKey   crypto.TwofishKey     
	erasureCode modules.ErasureCoder  
	pieceSize   uint64                
	mode        uint32                
	deleted     bool                  
	staticUID string  
	mu sync.RWMutex
}
type fileContract struct {
	ID     types.FileContractID
	IP     modules.NetAddress
	Pieces []pieceData
	WindowStart types.BlockHeight
}
type pieceData struct {
	Chunk      uint64       
	Piece      uint64       
	MerkleRoot crypto.Hash  
}