utilEnc

package
v0.0.0-...-685d729 Latest Latest
Warning

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

Go to latest
Published: Apr 24, 2024 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AesCBCEncrypt

func AesCBCEncrypt(rawData []byte, key []byte) ([]byte, []byte, error)

aes加密,填充秘钥key的16位,24,32分别对应AES-128, AES-192, or AES-256.

func AesCbcDecrypt

func AesCbcDecrypt(enData []byte, key []byte, iv []byte) ([]byte, error)

func HashSha256

func HashSha256(src string) string

func Md5

func Md5(str string) string

func NullUnPadding

func NullUnPadding(in []byte) []byte

func PKCS7Padding

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

func PKCS7UnPadding

func PKCS7UnPadding(data []byte) []byte

func PasswordHash

func PasswordHash(password string) (string, error)

func PasswordVerify

func PasswordVerify(password, hash string) bool

Types

type AesEncryptor

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

func NewAesEncryptor

func NewAesEncryptor(secret string) (aesEncryptor *AesEncryptor)

func (*AesEncryptor) Decrypt

func (ae *AesEncryptor) Decrypt(data string, v interface{}) (err error)

func (*AesEncryptor) DecryptString

func (ae *AesEncryptor) DecryptString(data string) (string, error)

func (*AesEncryptor) Encrypt

func (ae *AesEncryptor) Encrypt(data interface{}) (string, error)

func (*AesEncryptor) EncryptString

func (ae *AesEncryptor) EncryptString(data string) (string, error)

func (*AesEncryptor) GetSecret

func (ae *AesEncryptor) GetSecret() string

func (*AesEncryptor) SetSecret

func (ae *AesEncryptor) SetSecret(secret string) *AesEncryptor

Jump to

Keyboard shortcuts

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