pwd

package
v1.8.51 Latest Latest
Warning

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

Go to latest
Published: Aug 27, 2024 License: LGPL-3.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const (
	Argon2Time    = 1
	Argon2Memory  = 64 * 1024
	Argon2Threads = 4
	Argon2KeyLen  = 32
	SaltSize      = 16
)

Argon2 参数

Variables

View Source
var (
	ErrInvalidSecPwdLength      = errors.New("password must be 6 digits")
	ErrInvalidSecPwdConsecutive = errors.New("password must not contain three consecutive identical digits")
	ErrInvalidSecPwdSequential  = errors.New("password must not contain three or more sequential digits")
)

定义常见错误消息

Functions

func GenSalt added in v1.8.16

func GenSalt(size int) ([]byte, error)

GenSalt 生成指定长度的盐值

func IsCorrect added in v1.8.16

func IsCorrect(pwd, hashStr string) bool

IsCorrect 用于比较输入的密码和存储的散列值是否匹配

func SplitHash

func SplitHash(hash string) []string

SplitHash 分割存储的散列值和盐值

func ToHash added in v1.8.18

func ToHash(password string) (string, error)

ToHash 使用 argon2id 算法生成密码的散列值

func ValidateNumberPwd added in v1.8.17

func ValidateNumberPwd(secPwd string, length int) error

ValidateNumberPwd 验证指定长度的纯数字字符串密码

Types

This section is empty.

Jump to

Keyboard shortcuts

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