fastencrypt

package
v0.0.10 Latest Latest
Warning

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

Go to latest
Published: May 1, 2023 License: MIT Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ChaCha20Poly1305Decrypt

func ChaCha20Poly1305Decrypt(key, nonce, ciphertext []byte) ([]byte, error)

ChaCha20Poly1305Decrypt decrypts the given ciphertext with the given key and nonce using the ChaCha20-Poly1305 AEAD cipher. The plaintext is returned. The key length must be 32 bytes, and the nonce length must be 12 bytes.

func ChaCha20Poly1305Encrypt

func ChaCha20Poly1305Encrypt(key, nonce, plaintext []byte) ([]byte, error)

ChaCha20Poly1305Encrypt encrypts the given plaintext with the given key and nonce using the ChaCha20-Poly1305 AEAD cipher. The ciphertext is returned. The key length must be 32 bytes, and the nonce length must be 12 bytes.

func GenerateNonce

func GenerateNonce() []byte

GenerateNonce generates a random 12-byte nonce using the crypto/rand package.

Types

This section is empty.

Jump to

Keyboard shortcuts

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