utils

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Apr 5, 2023 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// ZstdCompress
	ZstdCompress, _ = zstd.NewWriter(nil)
	// ZstdDecompress
	ZstdDecompress, _ = zstd.NewReader(nil)
)

Functions

func BcryptHash

func BcryptHash(password string) string

BcryptHash 使用 bcrypt 对密码进行加密

func BcryptVerify

func BcryptVerify(password, hash string) bool

BcryptVerify 对比明文密码和数据库的哈希值

func Compress

func Compress(data []byte) []byte

Compress 压缩

func Decompress

func Decompress(data []byte) ([]byte, error)

Decompress 解压

func Decrypt

func Decrypt(key string, token string) string

Decrypt 解密

func Encrypt

func Encrypt(key string, token string) string

Encrypt 加密

func Random

func Random(len int) string

Random 随机字符串

func SaveToken

func SaveToken(t string, token string)

SaveToken 保存令牌

func Token

func Token(t string) string

Token 令牌

Types

This section is empty.

Jump to

Keyboard shortcuts

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