chachaPoly

package
v0.0.0-...-4eea697 Latest Latest
Warning

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

Go to latest
Published: Sep 26, 2023 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// KeyLength is the size of the key used by this AEAD, in bytes.
	KeyLength = 32

	// NonceLength 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.
	NonceLength = 12

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

Variables

This section is empty.

Functions

This section is empty.

Types

type Key

type Key [KeyLength]byte

func GenerateKey

func GenerateKey() *Key

func NewKeyFromBytes

func NewKeyFromBytes(keyBytes []byte) (*Key, error)

func (Key) Bytes

func (k Key) Bytes() []byte

func (Key) Decrypt

func (k Key) Decrypt(encrypted []byte) ([]byte, error)

func (Key) DecryptWithAuthData

func (k Key) DecryptWithAuthData(encrypted, authData []byte) ([]byte, error)

func (Key) Encrypt

func (k Key) Encrypt(msg []byte) ([]byte, error)

func (Key) EncryptWithAuthData

func (k Key) EncryptWithAuthData(msg, authData []byte) ([]byte, error)

func (Key) String

func (k Key) String() string

Jump to

Keyboard shortcuts

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