crypto

package
Version: v1.65.3 Latest Latest
Warning

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

Go to latest
Published: Oct 19, 2021 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

PKCS5Padding ...

func PKCS5UnPadding

func PKCS5UnPadding(origData []byte) []byte

PKCS5UnPadding ...

func ZeroPadding

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

ZeroPadding ...

func ZeroUnPadding

func ZeroUnPadding(origData []byte) []byte

ZeroUnPadding ...

Types

type AES

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

AES ...

func NewAES

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

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

func (*AES) Decrypt

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

Decrypt ...

func (*AES) Encrypt

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

Encrypt ...

type Crypto

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

Crypto ...

type DES

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

DES ...

func NewDES

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

NewDES ...

func (*DES) Decrypt

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

Decrypt 密钥key长度固定8字节

func (*DES) Encrypt

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

Encrypt ...

type TripleDES

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

TripleDES ...

func NewTripleDES

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

NewTripleDES ...

func (*TripleDES) Decrypt

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

Decrypt 3DES解密

func (*TripleDES) Encrypt

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

Encrypt 3DES加密 24字节

Jump to

Keyboard shortcuts

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