password

package
v1.0.0-10 Latest Latest
Warning

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

Go to latest
Published: Jul 13, 2022 License: MPL-2.0 Imports: 5 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 ValidatePassword

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