xchacha20poly1305

package
v100.0.4 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 3, 2024 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Overview

Package xchacha20poly1305 creates an AEAD using hchacha, chacha, and poly1305 This allows for randomized nonces to be used in conjunction with chacha.

Index

Constants

View Source
const (
	// KeySize is the size of the key used by this AEAD, in bytes.
	KeySize = 32
	// NonceSize is the size of the nonce used with this AEAD, in bytes.
	NonceSize = 24
	// TagSize is the size added from poly1305.
	TagSize = 16
	// MaxPlaintextSize is the max size that can be passed into a single call of Seal.
	MaxPlaintextSize = (1 << 38) - 64
	// MaxCiphertextSize is the max size that can be passed into a single call of Open,
	// this differs from plaintext size due to the tag.
	MaxCiphertextSize = (1 << 38) - 48
)

Variables

View Source
var (
	ErrInvalidKeyLen        = errors.New("xchacha20poly1305: bad key length")
	ErrInvalidNonceLen      = errors.New("xchacha20poly1305: bad nonce length")
	ErrInvalidCipherTextLen = errors.New("xchacha20poly1305: ciphertext too large")
)

Functions

func HChaCha20

func HChaCha20(out *[32]byte, nonce *[16]byte, key *[32]byte)

HChaCha20 generates 32 pseudo-random bytes from a 128 bit nonce and a 256 bit secret key. It can be used as a key-derivation-function (KDF).

func New

func New(key []byte) (cipher.AEAD, error)

New returns a new xchachapoly1305 AEAD.

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL