password

package
v1.0.8 Latest Latest
Warning

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

Go to latest
Published: Jul 15, 2021 License: MPL-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	MinPasswordLength = 9
	MaxPasswordLength = 72

	// ErrPasswordTooShort ...
	ErrPasswordTooShort = fmt.Errorf(
		"Password must be at least %d characters long",
		MinPasswordLength,
	)

	// ErrPasswordTooLong ...
	ErrPasswordTooLong = fmt.Errorf(
		"Password must be at maximum %d characters long",
		MaxPasswordLength,
	)

	// ErrPasswordTooWeak ...
	ErrPasswordTooWeak = errors.New("Password is too weak")
)

Functions

func HashPassword

func HashPassword(password string) ([]byte, error)

HashPassword creates a bcrypt password hash

func HashWpPassword added in v1.0.5

func HashWpPassword(password string) ([]byte, error)

HashWpPassword creates a phpass password hash

func ValidatePassword added in v1.0.8

func ValidatePassword(password string) error

ValidatePassword

func VerifyPassword

func VerifyPassword(passwordHash, password string) error

VerifyPassword compares password and the hashed password Fallback to phpass if bcrypt fails

Types

This section is empty.

Jump to

Keyboard shortcuts

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