encryption

package
v1.1.1 Latest Latest
Warning

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

Go to latest
Published: Sep 22, 2025 License: Apache-2.0 Imports: 8 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type EncryptorDecryptor

type EncryptorDecryptor[T any] struct {
	// contains filtered or unexported fields
}

func New

func New[T any](salt []byte, iterations int) (*EncryptorDecryptor[T], error)

New creates a new EncryptorDecryptor instance with a random password and nonce.

func NewWithPasswordNonce

func NewWithPasswordNonce[T any](password, nonce, salt []byte, iterations int) (*EncryptorDecryptor[T], error)

NewWithPasswordNonce creates a new EncryptorDecryptor instance with a specified password and nonce. Use this if you intend to persist whatever is encrypted.

func (*EncryptorDecryptor[T]) Decrypt

func (e *EncryptorDecryptor[T]) Decrypt(ciphertext []byte) (T, error)

func (*EncryptorDecryptor[T]) Encrypt

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

Jump to

Keyboard shortcuts

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