Documentation
¶
Overview ¶
Package chacha8 implements the ChaCha8 stream cipher.
Index ¶
Constants ¶
View Source
const ( // KeySize is the ChaCha8 key size in bytes. KeySize = 32 // NonceSize is the ChaCha8 nonce size in bytes. NonceSize = 8 // INonceSize is the IETF ChaCha8 nonce size in bytes. INonceSize = 12 // XNonceSize is the XChaCha8 nonce size in bytes. XNonceSize = 24 // HNonceSize is the HChaCha8 nonce size in bytes. HNonceSize = 16 )
Variables ¶
View Source
var ( // ErrInvalidKey is the error returned when the key is invalid. ErrInvalidKey = errors.New("chacha8: key length must be KeySize bytes") // ErrInvalidNonce is the error returned when the nonce is invalid. ErrInvalidNonce = errors.New("chacha8: nonce length must be NonceSize/INonceSize/XNonceSize bytes") // ErrInvalidCounter is the error returned when the counter is invalid. ErrInvalidCounter = errors.New("chacha8: block counter is invalid (out of range)") )
Functions ¶
Types ¶
type Cipher ¶
type Cipher struct {
// contains filtered or unexported fields
}
Cipher is an instance of ChaCha8/XChaCha8 using a particular key and nonce.
func (*Cipher) ReKey ¶
ReKey reinitializes the ChaCha8/XChaCha8 instance with the provided key and nonce.
func (*Cipher) Reset ¶
func (c *Cipher) Reset()
Reset zeros the key data so that it will no longer appear in the process's memory.
func (*Cipher) XORKeyStream ¶
XORKeyStream sets dst to the result of XORing src with the key stream. Dst and src may be the same slice but otherwise should not overlap.
Directories
¶
Path | Synopsis |
---|---|
internal
|
|
api
Package api provides the ChaCha8 implementation abstract interface.
|
Package api provides the ChaCha8 implementation abstract interface. |
hardware
Package hardware provides the hardware accelerated ChaCha8 implementations.
|
Package hardware provides the hardware accelerated ChaCha8 implementations. |
ref
Package ref provides the portable ChaCha8 implementation.
|
Package ref provides the portable ChaCha8 implementation. |
Click to show internal directories.
Click to hide internal directories.