chacha20

package
v0.5.1 Latest Latest
Warning

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

Go to latest
Published: Dec 19, 2025 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrMissmatchedNonceSize = errors.New("missmatched nonce size")

Functions

This section is empty.

Types

type Encrypter

type Encrypter struct {
	// contains filtered or unexported fields
}

func NewEncrypter

func NewEncrypter(key []byte) (*Encrypter, error)

NewEncrypter creates a new ChaCha20-Poly1305 encrypter. Key must be exactly 32 bytes.

func (*Encrypter) Decrypt

func (e *Encrypter) Decrypt(value []byte) ([]byte, error)

Decrypt decrypts the ciphertext using ChaCha20-Poly1305. Expects nonce to be prepended to ciphertext.

func (*Encrypter) Encrypt

func (e *Encrypter) Encrypt(value []byte) ([]byte, error)

Encrypt encrypts the plaintext using ChaCha20-Poly1305. Returns ciphertext with nonce prepended.

Jump to

Keyboard shortcuts

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