crypto

package
v1.64.0 Latest Latest
Warning

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

Go to latest
Published: May 3, 2020 License: BSD-3-Clause Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func PKCS5Padding

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

func PKCS5UnPadding

func PKCS5UnPadding(origData []byte) []byte

func ZeroPadding

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

func ZeroUnPadding

func ZeroUnPadding(origData []byte) []byte

Types

type AES

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

func NewAES

func NewAES(key, iv []byte) *AES

AES 密钥长度为 16,24,32 字节,三种

func (*AES) Decrypt

func (a *AES) Decrypt(crypted []byte) ([]byte, error)

func (*AES) Encrypt

func (a *AES) Encrypt(origData []byte) ([]byte, error)

type Crypto

type Crypto interface {
	Encrypt(origData []byte) ([]byte, error)
	Decrypt(crypted []byte) ([]byte, error)
}

type DES

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

func NewDES

func NewDES(key, iv []byte) *DES

func (*DES) Decrypt

func (d *DES) Decrypt(crypted []byte) ([]byte, error)

密钥key长度固定8字节

func (*DES) Encrypt

func (d *DES) Encrypt(origData []byte) ([]byte, error)

type TripleDES

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

func NewTripleDES

func NewTripleDES(key, iv []byte) *TripleDES

func (*TripleDES) Decrypt

func (d *TripleDES) Decrypt(crypted []byte) ([]byte, error)

3DES解密

func (*TripleDES) Encrypt

func (d *TripleDES) Encrypt(origData []byte) ([]byte, error)

3DES加密 24字节

Jump to

Keyboard shortcuts

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