crypto

package
v0.2.5 Latest Latest
Warning

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

Go to latest
Published: Jan 20, 2021 License: MIT Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrCipherTextLengthIncorrect = errors.New("Cipher text is not a multiple of the block size ")
)

Functions

func MD5

func MD5(src []byte) []byte

func NewRSAKeys

func NewRSAKeys(bits int) (publicKey []byte, privateKey []byte, err error)

func SHA1

func SHA1(src []byte) []byte

func SHA256

func SHA256(src []byte) []byte

func SHA512

func SHA512(src []byte) []byte

Types

type Coder

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

func NewAESCoderWithCBC

func NewAESCoderWithCBC(key, iv []byte) (Coder, error)

func NewAESCoderWithECB

func NewAESCoderWithECB(key []byte) (Coder, error)

type RSADecoder

type RSADecoder interface {
	Decrypt([]byte) ([]byte, error)
	Sign(msg []byte) ([]byte, error)
}

func NewRSADecoder

func NewRSADecoder(privKey []byte) RSADecoder

type RSAEncoder

type RSAEncoder interface {
	Encrypt([]byte) ([]byte, error)
	VerifySign(msg, sign []byte) bool
}

func NewRSAEncoder

func NewRSAEncoder(pubKey []byte) RSAEncoder

Jump to

Keyboard shortcuts

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