xsecretbox

package
v0.0.2 Latest Latest
Warning

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

Go to latest
Published: Jul 2, 2026 License: Unlicense Imports: 6 Imported by: 0

Documentation

Overview

Package xsecretbox implements encryption/decryption of a message using specified keys.

Index

Constants

View Source
const (
	// KeySize is the size of the encryption key in bytes.
	KeySize = chacha20.KeySize

	// NonceSize is the size of the nonce in bytes.
	NonceSize = chacha20.NonceSizeX

	// TagSize is the size of the authentication tag in bytes.
	TagSize = poly1305.TagSize

	// BlockSize is the size of the cipher block in bytes.
	BlockSize = 64
)

Variables

This section is empty.

Functions

func Open

func Open(out, nonce, box, key []byte) (res []byte, err error)

Open decrypts and authenticates the box using the XChaCha20-Poly1305 algorithm, appending the result to the out parameter. nonce must be NonceSize elements long. key must be KeySize elements long.

func Seal

func Seal(out, nonce, message, key []byte) (res []byte)

Seal encrypts and authenticates message using XChaCha20-Poly1305 and appends the result to out. nonce must be NonceSize long. key must be KeySize long.

func SharedKey

func SharedKey(
	secretKey [curve25519.ScalarSize]byte,
	publicKey [curve25519.PointSize]byte,
) (sharedKey [KeySize]byte, err error)

SharedKey computes a shared secret compatible with the one used by 'crypto_box_xchacha20poly1305'.

TODO(f.setarakov): Find out what is 'crypto_box_xchacha20poly1305'.

Types

This section is empty.

Jump to

Keyboard shortcuts

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