passwd

package
v1.0.5 Latest Latest
Warning

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

Go to latest
Published: Mar 5, 2021 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func VerifyBcrypt

func VerifyBcrypt(ent IEntity) (bool, error)

VerifyBcrypt bcrypt

func VerifyBcrypt2

func VerifyBcrypt2(ent IEntity) (bool, error)

VerifyBcrypt2 bcrypt

func VerifyBcrypt3

func VerifyBcrypt3(ent IEntity) (bool, error)

VerifyBcrypt3 bcrypt

func VerifyMD5

func VerifyMD5(ent IEntity) (bool, error)

VerifyMD5 bcrypt

func VerifySHA1

func VerifySHA1(ent IEntity) (bool, error)

VerifySHA1 bcrypt

Types

type GeneratePasswd

type GeneratePasswd struct {
	Password     string // 加密后的密码
	PasswordSalt string // 密码盐值
	PasswordType string // 加密类型
}

GeneratePasswd 生成的密码

func GenerateBcrypt

func GenerateBcrypt(password string, ptype string) (*GeneratePasswd, error)

GenerateBcrypt bcrypt

func GenerateBcrypt2

func GenerateBcrypt2(password string, ptype string) (*GeneratePasswd, error)

GenerateBcrypt2 bcrypt

func GenerateBcrypt3

func GenerateBcrypt3(password string, ptype string) (*GeneratePasswd, error)

GenerateBcrypt3 bcrypt

func GenerateMD5

func GenerateMD5(password string, ptype string) (*GeneratePasswd, error)

GenerateMD5 bcrypt

func GenerateSHA1

func GenerateSHA1(password string, ptype string) (*GeneratePasswd, error)

GenerateSHA1 bcrypt

func (*GeneratePasswd) Salt

func (a *GeneratePasswd) Salt() string

Salt salt

func (*GeneratePasswd) Source

func (a *GeneratePasswd) Source() string

Source right

func (*GeneratePasswd) Type

func (a *GeneratePasswd) Type() string

Type type

type IEntity

type IEntity interface {
	Target() string // 前端输入,待匹配的密码, 一般为原文
	Source() string // 后端存储,加密后的密码, 一般为hash值
	Salt() string   // 密码盐值, 用于胡乱密码的加密
	Type() string   // 加密类型
}

IEntity 需要验证的实体

type Validator

type Validator struct {
}

Validator 密码验证器

func (*Validator) Generate

func (a *Validator) Generate(password string, ptype string) (*GeneratePasswd, error)

Generate 生成密码

func (*Validator) Verify

func (a *Validator) Verify(ent IEntity) (bool, error)

Verify 验证密码是否通过

Jump to

Keyboard shortcuts

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