// NewChaChaStream initialize a new ChaChaStream interfaced with Stream
NewChaChaStream initialize a new ChaChaStream interfaced with Stream
// NewChaChaStream initialize a new ChaChaStream interfaced with Stream
func NewChaChaStream(key []byte) (*ChaChaStream, error) {
	hash := sha512.Sum512(key)
	cipher, err := chacha20.NewCipher(hash[32:44], hash[:32])
	if err != nil {
		return nil, err
	}
	c := ChaChaStream{
		cipher: cipher,
	}
	return &c, nil
}
func NewChaChaStream ( key [ ] byte ) ( * ChaChaStream , error ) { hash := sha512 . Sum512 ( key ) cipher , err := chacha20 . NewCipher ( hash [ 32 : 44 ] , hash [ : 32 ] ) if err != nil { return nil , err } c := ChaChaStream { cipher : cipher , } return & c , nil }
NewChaChaStream initialize a new ChaChaStream interfaced with Stream
NewChaChaStream initialize a new ChaChaStream interfaced with Stream