aes

package
v0.1.2 Latest Latest
Warning

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

Go to latest
Published: Oct 16, 2018 License: BSD-3-Clause Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Cipher

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

Cipher defines resenje.org/cipher.StringCipher interface.

func New

func New(key []byte, opts ...Option) (c Cipher)

New returns a new Cipher instance with a given key. The key argument should be the AES key, either 16, 24, or 32 bytes to select AES-128, AES-192, or AES-256.

func (Cipher) DecryptString

func (c Cipher) DecryptString(input string) (output string, err error)

DecryptString decrypts input string produced by EncryptString. It performs AES encryption and validates Adler32 checksum.

func (Cipher) EncryptString

func (c Cipher) EncryptString(input string) (output string, err error)

EncryptString encrypts input string using AES encryption and Adler32 checksum for data validation.

type Option added in v0.1.2

type Option func(*Cipher)

Option is used to specify optional parameters to the New constructor.

func WithInputEncoder added in v0.1.2

func WithInputEncoder(e cipher.StringEncoder) Option

WithInputEncoder sets the EncryptString input data encoding. By default, no input data decoding of input data is performed. If the input data is always with the same encoding, encrypted strings can be reduced in size, buy specifying this option.

func WithOutputEncoder added in v0.1.2

func WithOutputEncoder(e cipher.StringEncoder) Option

WithOutputEncoder sets the EncryptString returned data encoding. By default, resenje.org/cipher.DefaultEncoder is used.

Jump to

Keyboard shortcuts

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