encryption

package
v0.4.1 Latest Latest
Warning

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

Go to latest
Published: Aug 6, 2025 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AESEncryptor

type AESEncryptor struct{}

AESEncryptor implements AES encryption/decryption

func NewAESEncryptor

func NewAESEncryptor() *AESEncryptor

func (*AESEncryptor) Decrypt

func (e *AESEncryptor) Decrypt(key []byte, data []byte) ([]byte, error)

Decrypt decrypts data using AES-GCM

func (*AESEncryptor) Encrypt

func (e *AESEncryptor) Encrypt(key []byte, data []byte) ([]byte, error)

Encrypt encrypts data using AES-GCM with a random nonce

type ChaCha20Encryptor

type ChaCha20Encryptor struct{}

ChaCha20Encryptor implements XChaCha20-Poly1305 encryption/decryption

func NewChaCha20Encryptor

func NewChaCha20Encryptor() *ChaCha20Encryptor

NewChaCha20Encryptor creates a new ChaCha20Encryptor

func (*ChaCha20Encryptor) Decrypt

func (c *ChaCha20Encryptor) Decrypt(key []byte, data []byte) ([]byte, error)

Decrypt decrypts data using XChaCha20-Poly1305

func (*ChaCha20Encryptor) Encrypt

func (c *ChaCha20Encryptor) Encrypt(key []byte, data []byte) ([]byte, error)

Encrypt encrypts data using XChaCha20-Poly1305 with a random nonce

type Cipher

type Cipher interface {
	Encrypt(key, data []byte) ([]byte, error)
	Decrypt(key, encryptedData []byte) ([]byte, error)
}

Interface for decoupling the message encryption and decryption

Jump to

Keyboard shortcuts

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