password

package
v0.2.1 Latest Latest
Warning

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

Go to latest
Published: Jun 10, 2020 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrCompareFailed = errors.New("verify compare failed")

Functions

This section is empty.

Types

type BCrypt

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

func NewBCrypt

func NewBCrypt(privateKey string) *BCrypt

func (BCrypt) Compare

func (sf BCrypt) Compare(password, hash string) error

Compare 密码hash验证

func (BCrypt) Hash

func (sf BCrypt) Hash(password string) (string, error)

Hash 密码hash运算

type Simple

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

func NewSimple

func NewSimple(key string) *Simple

func (Simple) Compare

func (sf Simple) Compare(password, hash string) error

func (Simple) Hash

func (sf Simple) Hash(password string) (string, error)

Hash 生成密钥 加盐法 md5Pwd+`@#$%`+md5Pwd+`^&*()`拼接

type Verify

type Verify interface {
	Hash(password string) (string, error)
	Compare(password, hash string) error
}

Jump to

Keyboard shortcuts

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