cipher

package module
v0.1.5 Latest Latest
Warning

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

Go to latest
Published: Oct 3, 2022 License: BSD-3-Clause Imports: 2 Imported by: 0

README

Convenient encryption tools

GoDoc

Installation

Run go get resenje.org/cipher from command line.

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrInvalidData = errors.New("invalid data")

ErrInvalidData should be returned by DecryptString if the data validation fails.

Functions

This section is empty.

Types

type BytesCipher added in v0.1.5

type BytesCipher interface {
	Encrypt([]byte) ([]byte, error)
	Decrypt([]byte) ([]byte, error)
}

BytesCipher defines methods that need to be defined to have a convenient way to encrypt and decrypt arbitrary data.

type Cipher added in v0.1.5

type Cipher interface {
	BytesCipher
	StringCipher
}

BytesCipher defines methods that need to be defined to have a convenient way to encrypt and decrypt arbitrary data and strings.

type StringCipher

type StringCipher interface {
	EncryptString(string) (string, error)
	DecryptString(string) (string, error)
}

StringCipher defines methods that need to be defined to have a convenient way to encrypt and decrypt arbitrary strings.

type StringEncoder added in v0.1.2

type StringEncoder interface {
	EncodeToString([]byte) string
	DecodeString(string) ([]byte, error)
}

StringEncoder is used to specify encoding for input or output data.

var DefaultEncoder StringEncoder = base32.NewEncoding("0123456789abcdefghjkmnpqrstvwxyz").WithPadding(base32.NoPadding)

DefaultEncoding is a Base32 encoding with "0123456789abcdefghjkmnpqrstvwxyz" charset and without padding. It is used to encode data returned by EncryptString.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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