// NewSalsaStream initialize a new SalsaStream interfaced with CryptoStream
NewSalsaStream initialize a new SalsaStream interfaced with CryptoStream
// NewSalsaStream initialize a new SalsaStream interfaced with CryptoStream
func NewSalsaStream(key []byte) (*SalsaStream, error) {
	hash := sha256.Sum256(key)
	state := make([]uint32, 16)
	state[1] = u8to32little(hash[:], 0)
	state[2] = u8to32little(hash[:], 4)
	state[3] = u8to32little(hash[:], 8)
	state[4] = u8to32little(hash[:], 12)
	state[11] = u8to32little(hash[:], 16)
	state[12] = u8to32little(hash[:], 20)
	state[13] = u8to32little(hash[:], 24)
	state[14] = u8to32little(hash[:], 28)
	state[0] = sigmaWords[0]
	state[5] = sigmaWords[1]
	state[10] = sigmaWords[2]
	state[15] = sigmaWords[3]
	state[6] = u8to32little(iv, 0)
	state[7] = u8to32little(iv, 4)
	state[8] = uint32(0)
	state[9] = uint32(0)
	s := SalsaStream{
		State:        state,
		blockUsed:    64, 
		currentBlock: make([]byte, 0),
	}
	return &s, nil
}
func NewSalsaStream ( key [ ] byte ) ( * SalsaStream , error ) { hash := sha256 . Sum256 ( key ) state := make ( [ ] uint32 , 16 ) state [ 1 ] = u8to32little ( hash [ : ] , 0 ) state [ 2 ] = u8to32little ( hash [ : ] , 4 ) state [ 3 ] = u8to32little ( hash [ : ] , 8 ) state [ 4 ] = u8to32little ( hash [ : ] , 12 ) state [ 11 ] = u8to32little ( hash [ : ] , 16 ) state [ 12 ] = u8to32little ( hash [ : ] , 20 ) state [ 13 ] = u8to32little ( hash [ : ] , 24 ) state [ 14 ] = u8to32little ( hash [ : ] , 28 ) state [ 0 ] = sigmaWords [ 0 ] state [ 5 ] = sigmaWords [ 1 ] state [ 10 ] = sigmaWords [ 2 ] state [ 15 ] = sigmaWords [ 3 ] state [ 6 ] = u8to32little ( iv , 0 ) state [ 7 ] = u8to32little ( iv , 4 ) state [ 8 ] = uint32 ( 0 ) state [ 9 ] = uint32 ( 0 ) s := SalsaStream { State : state , blockUsed : 64 , currentBlock : make ( [ ] byte , 0 ) , } return & s , nil }
NewSalsaStream initialize a new SalsaStream interfaced with CryptoStream
NewSalsaStream initialize a new SalsaStream interfaced with CryptoStream
// Ensure a fresh block is generated, the first time bytes are needed