symmetric

package
v2.14.3 Latest Latest
Warning

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

Go to latest
Published: Sep 13, 2024 License: Apache-2.0 Imports: 11 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	AesHelper        Aes
	AesEncryptHelper AesEncrypt
	AesDecryptHelper AesDecrypt
)

Functions

This section is empty.

Types

type Aes

type Aes struct {
	Err     error
	Encrypt *AesEncrypt
	Decrypt *AesDecrypt
	// contains filtered or unexported fields
}

Aes Aes密钥对象

func (*Aes) GetDecrypt

func (r *Aes) GetDecrypt() *AesDecrypt

GetDecrypt 获取解密密钥

func (*Aes) GetEncrypt

func (r *Aes) GetEncrypt() *AesEncrypt

GetEncrypt 获取加密密钥

func (Aes) New

func (Aes) New(sail string) *Aes

New 实例化:Aes密钥

func (*Aes) NewDecrypt

func (r *Aes) NewDecrypt(openKey string) *Aes

NewDecrypt 实例化:Aes解密密钥对象

func (*Aes) NewEncrypt

func (r *Aes) NewEncrypt() *Aes

NewEncrypt 实例化:Aes加密密钥对象

type AesDecrypt

type AesDecrypt struct {
	Err error
	// contains filtered or unexported fields
}

AesDecrypt Aes解密密钥对象

func (*AesDecrypt) GetAesKey

func (r *AesDecrypt) GetAesKey() []byte

GetAesKey 获取加盐后的密钥

func (*AesDecrypt) GetOpenKey

func (r *AesDecrypt) GetOpenKey() string

GetOpenKey 获取公开密码

func (AesDecrypt) New

func (AesDecrypt) New(sailStr, openKey string) *AesDecrypt

New 实例化:Aes解密密钥对象

func (*AesDecrypt) SetAesKey

func (r *AesDecrypt) SetAesKey(aesKey []byte) *AesDecrypt

SetAesKey 设置加盐后的密钥

type AesEncrypt

type AesEncrypt struct {
	Err error
	// contains filtered or unexported fields
}

AesEncrypt Aes加密密钥对象

func (*AesEncrypt) GetAesKey

func (r *AesEncrypt) GetAesKey() []byte

GetAesKey 获取加盐后的密钥

func (*AesEncrypt) GetOpenKey

func (r *AesEncrypt) GetOpenKey() string

GetOpenKey 获取公开密码

func (AesEncrypt) New

func (AesEncrypt) New(sailStr string) *AesEncrypt

New 实例化:Aes加密密钥对象

func (*AesEncrypt) SetAesKey

func (r *AesEncrypt) SetAesKey(aesKey []byte) *AesEncrypt

SetAesKey 设置加盐后的密钥

type Cbc

type Cbc struct{}
var CbcHelper Cbc

func (Cbc) Decrypt

func (Cbc) Decrypt(cipherText, key, iv []byte, ivs ...[]byte) ([]byte, error)

func (Cbc) Demo

func (Cbc) Demo()

func (Cbc) Encrypt

func (Cbc) Encrypt(plainText, key, iv []byte, ivs ...[]byte) ([]byte, error)

func (Cbc) New

func (Cbc) New() *Cbc

type Ecb

type Ecb struct{}
var EcbHelper Ecb

func (Ecb) Decrypt

func (Ecb) Decrypt(cipherText, key []byte) ([]byte, error)

Decrypt decrypts cipherText using AES in ECB mode

func (Ecb) Demo

func (Ecb) Demo()

func (Ecb) Encrypt

func (Ecb) Encrypt(plaintext, key []byte) ([]byte, error)

Encrypt encrypts plaintext using AES in ECB mode

func (Ecb) New

func (Ecb) New() *Ecb

type Source

type Source struct {
	Username string `json:"username"`
	Password string `json:"password"`
}

Jump to

Keyboard shortcuts

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