sym

package
v1.0.0-rc2 Latest Latest
Warning

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

Go to latest
Published: Apr 21, 2020 License: Apache-2.0 Imports: 8 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GenerateKey

func GenerateKey(opt AlgorithmType, key []byte) (crypto.SymmetricKey, error)

func PKCS5Padding

func PKCS5Padding(ciphertext []byte, blockSize int) []byte

PKCS5Padding padding with pkcs5

func PKCS5UnPadding

func PKCS5UnPadding(origData []byte) ([]byte, error)

PKCS5UnPadding unpadding with pkcs5

func TripleDesDec

func TripleDesDec(key, src []byte) ([]byte, error)

TripleDesDec decryption algorithm implements

func TripleDesEnc

func TripleDesEnc(key, src []byte) ([]byte, error)

TripleDesEnc encryption algorithm implements

Types

type AESKey

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

AES a AES instance is a tool to encrypt and decrypt

func (*AESKey) Bytes

func (ek *AESKey) Bytes() ([]byte, error)

Bytes return bytes

func (*AESKey) Decrypt

func (ek *AESKey) Decrypt(crypted []byte) ([]byte, error)

Decrypt decrypt

func (*AESKey) Encrypt

func (ek *AESKey) Encrypt(plain []byte) ([]byte, error)

Encrypt encrypt

type AlgorithmType

type AlgorithmType int32

HashType represent hash algorithm type

const (
	AES AlgorithmType = iota
	ThirdDES
)

type ThirdDESKey

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

TripleDES a 3DES instance is a tool to encrypt and decrypt Very not recommended to use 3des!!! It's slow and unsafe

func (*ThirdDESKey) Bytes

func (ea *ThirdDESKey) Bytes() ([]byte, error)

func (*ThirdDESKey) Decrypt

func (ea *ThirdDESKey) Decrypt(cipherTex []byte) (plaintext []byte, err error)

Decrypt decrypt

func (*ThirdDESKey) Encrypt

func (ea *ThirdDESKey) Encrypt(plain []byte) (cipher []byte, err error)

Encrypt encrypt

Jump to

Keyboard shortcuts

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