go1.20.5
GoThrough

chacha20poly1305.KeySize

// KeySize is the size of the key used by this AEAD, in bytes. const KeySize = 32

chacha20poly1305.NonceSize

// NonceSize is the size of the nonce used with the standard variant of this // AEAD, in bytes. // // Note that this is too short to be safely generated at random if the same // key is reused more than 2³² times. const NonceSize = 12

chacha20poly1305.NonceSizeX

// NonceSizeX is the size of the nonce used with the XChaCha20-Poly1305 // variant of this AEAD, in bytes. const NonceSizeX = 24

chacha20poly1305.Overhead

// Overhead is the size of the Poly1305 authentication tag, and the // difference between a ciphertext length and its plaintext. const Overhead = 16

chacha20poly1305.New

// New returns a ChaCha20-Poly1305 AEAD that uses the given 256-bit key. func New(key []byte) (cipher.AEAD, error)

chacha20poly1305.NewX

// NewX returns a XChaCha20-Poly1305 AEAD that uses the given 256-bit key. // // XChaCha20-Poly1305 is a ChaCha20-Poly1305 variant that takes a longer nonce, // suitable to be generated randomly without risk of collisions. It should be // preferred when nonce uniqueness cannot be trivially ensured, or whenever // nonces are randomly generated. func NewX(key []byte) (cipher.AEAD, error)