util

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Oct 13, 2022 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const (
	PasswordCost = 12
)

Variables

This section is empty.

Functions

func CheckPassword

func CheckPassword(password string) int

CheckPassword 校验密码

func CheckUsername

func CheckUsername(username string) int

CheckUsername 校验用户名

func EncryptPassByBCR

func EncryptPassByBCR(password string) (string, error)

EncryptPassByBCR BCR加密

func EncryptPassByMd5

func EncryptPassByMd5(password string) (string, error)

EncryptPassByMd5 MD5加密

func GenerateToken

func GenerateToken() string

GenerateToken 生成token '0' 48 'A' 65

func Uint32

func Uint32() uint32

Uint32 returns pseudorandom uint32. It is safe calling this function from concurrent goroutines.

func Uint32n

func Uint32n(maxN uint32) uint32

Uint32n returns pseudorandom uint32 in the range [0..maxN). It is safe calling this function from concurrent goroutines.

func VerifyPassByBCR

func VerifyPassByBCR(password string, hashedPassword string) bool

VerifyPassByBCR BCR校验 password 用户输入密码 hashedPassword 数据库存储密码

func VerifyPassByMD5

func VerifyPassByMD5(password string, hashedPassword string) bool

VerifyPassByMD5 MD5校验 password 用户输入密码 hashedPassword 数据库存储密码

Types

type RNG

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

RNG is a pseudorandom number generator. It is unsafe to call RNG methods from concurrent goroutines.

func (*RNG) Seed

func (r *RNG) Seed(n uint32)

Seed sets the r state to n.

func (*RNG) Uint32

func (r *RNG) Uint32() uint32

Uint32 returns pseudorandom uint32. It is unsafe to call this method from concurrent goroutines.

func (*RNG) Uint32n

func (r *RNG) Uint32n(maxN uint32) uint32

Uint32n returns pseudorandom uint32 in the range [0..maxN). It is unsafe to call this method from concurrent goroutines.

Jump to

Keyboard shortcuts

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