cipher

package
v0.6.0 Latest Latest
Warning

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

Go to latest
Published: Feb 7, 2024 License: BSD-3-Clause Imports: 7 Imported by: 0

Documentation

Overview

Package cipher implements AES encryption with GCM, KDF Hash

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AES

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

AES implements encrypt/decrypt AES algorithm (GCM)

func NewAES

func NewAES(secret string, opts ...Option) *AES

NewAES creates AES

func (*AES) Decrypt

func (c *AES) Decrypt(ciphertext, salt []byte) ([]byte, error)

Decrypt implements decrypt and authenticates ciphertext

func (*AES) Encrypt

func (c *AES) Encrypt(plaintext, salt []byte) ([]byte, error)

Encrypt implements encrypt and authenticates plaintext

func (*AES) NewInt32Salt added in v0.1.2

func (c *AES) NewInt32Salt(data int32) []byte

NewInt32Salt returns bytes for using salt

func (*AES) NewInt64Salt

func (c *AES) NewInt64Salt(data int64) []byte

NewInt64Salt returns bytes for using salt

type Option

type Option func(*AES)

Option defines configure AES settings

func WithAES128

func WithAES128() Option

WithAES128 configures AES128 algorithm

func WithAES192

func WithAES192() Option

WithAES192 configures AES192 algorithm

func WithAES256

func WithAES256() Option

WithAES256 configures AES256 algorithm

func WithHKDFHash

func WithHKDFHash(fn func() hash.Hash) Option

WithHKDFHash configures Key Derivation Function (HKDF)

func WithHKDFInfo

func WithHKDFInfo(info []byte) Option

WithHKDFInfo configures Key Derivation Function (HKDF) info

func WithNonceLength

func WithNonceLength(n int) Option

WithNonceLength configures nonce length

Jump to

Keyboard shortcuts

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