password

package
v0.2.4 Latest Latest
Warning

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

Go to latest
Published: Jun 19, 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")

ErrCompareFailed compare failed

Functions

This section is empty.

Types

type BCrypt

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

BCrypt bcrypt password encryption

func NewBCrypt

func NewBCrypt(privateKey string) *BCrypt

NewBCrypt new bcrypt password encryption with key

func (BCrypt) Compare

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

Compare password hash verification

func (BCrypt) Hash

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

Hash password hash encryption

type Simple

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

Simple simple password encryption

func NewSimple

func NewSimple(key string) *Simple

NewSimple new simple password encryption with key

func (Simple) Compare

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

Compare password hash verification

func (Simple) Hash

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

Hash password hash encryption 加盐法 md5Pwd+`@#$%`+md5Pwd+`^&*()`拼接

type Verify

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

Verify verify interface

Jump to

Keyboard shortcuts

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