security

package
v1.2.3 Latest Latest
Warning

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

Go to latest
Published: Aug 25, 2022 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrNotAlignedToBlock = errors.New("not aligned to block")
	ErrInvalidPadding    = errors.New("invalid padding")
)

Functions

func MustSha1Hash

func MustSha1Hash(s string) string

func Sha1Hash

func Sha1Hash(s string) (string, error)

Sha1Hash performs the SHA-1 hash algorithm and returns the hash result in hex.

Types

type AESCipher

type AESCipher interface {
	Encrypt(data []byte) []byte
	Decrypt(enc []byte) ([]byte, error)
}

func NewAESCipherWithPKCS7Padding

func NewAESCipherWithPKCS7Padding(key []byte) (AESCipher, error)

type PaddingScheme

type PaddingScheme interface {
	Pad(data []byte) []byte
	Strip(data []byte) ([]byte, error)
}

func NewPkcs5

func NewPkcs5() PaddingScheme

func NewPkcs7

func NewPkcs7(blockSize int) PaddingScheme

type PasswordCipher

type PasswordCipher interface {
	Key() string
	Encrypt(passwd string) string
	Decrypt(enc string) (string, error)
}

func MustNewPasswordCipher

func MustNewPasswordCipher(key string) PasswordCipher

func NewPasswordCipher

func NewPasswordCipher(key string) (PasswordCipher, error)

Jump to

Keyboard shortcuts

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