symmetric

package
v0.0.0-...-aa3fb43 Latest Latest
Warning

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

Go to latest
Published: Sep 6, 2024 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	// contains filtered or unexported fields
}

Config is the configuration for the encryptor.

type Encryptor

type Encryptor interface {
	Encrypt(plaintext []byte) ([]byte, error)
	Decrypt(ciphertext []byte) ([]byte, error)
}

Encryptor does symmetric encryption and decryption.

func New

func New(key string, opts ...Option) (Encryptor, error)

New allocates and configures an Encryptor.

type Option

type Option func(*Config) error

Option is optional configuration of the encryptor.

func WithBlockCypherProvider

func WithBlockCypherProvider(provider func(key []byte) (cipher.Block, error)) Option

WithBlockCypherProvider overwrites the provider for the block cipher.

func WithRandomDataFunc

func WithRandomDataFunc(randomDataFunc func(buffer []byte) error) Option

WithRandomDataFunc overwrites the random data function.

Jump to

Keyboard shortcuts

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