crypto

package
v0.10.9 Latest Latest
Warning

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

Go to latest
Published: Apr 30, 2024 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AesDeCrypt

func AesDeCrypt(cypted []byte, key []byte) ([]byte, error)

实现解密

func AesEcrypt

func AesEcrypt(origData []byte, key []byte) ([]byte, error)

实现加密

func GeneratePassword

func GeneratePassword(userPassword string) ([]byte, error)

GeneratePassword 给密码就行加密操作

func Md5 added in v0.3.1

func Md5(str string) string

func PKCS7Padding

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

PKCS7 填充模式

func PKCS7UnPadding

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

填充的反向操作,删除填充字符串

func ValidatePassword

func ValidatePassword(userPassword string, hashed string) (isOK bool, err error)

ValidatePassword 密码比对

Types

type Pwd

type Pwd struct {
	Key []byte
}

var PwdKey = []byte("DIS**#KKKDJJSKDI")

func (*Pwd) DePwdCode

func (k *Pwd) DePwdCode(pwd string) ([]byte, error)

解密

func (*Pwd) EnPwdCode

func (k *Pwd) EnPwdCode(pwd []byte) (string, error)

加密base64

Jump to

Keyboard shortcuts

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