Documentation ¶
Overview ¶
Package bcrypt can be used to hash data
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type PasswordHandler ¶
type PasswordHandler struct {
// contains filtered or unexported fields
}
PasswordHandler hashes and checks passwords.
func NewPasswordHandler ¶
func NewPasswordHandler() *PasswordHandler
NewPasswordHandler creates a bcrypt PasswordHandler with a default hash cost.
func (PasswordHandler) Hash ¶
func (ph PasswordHandler) Hash(password []byte) (hashedPassword []byte, err error)
Hash generates the password with the provided cost.
func (PasswordHandler) IsCorrectPassword ¶
func (ph PasswordHandler) IsCorrectPassword(hashedPassword, password []byte) (ok bool, err error)
IsCorrectPassword determines if the hashed password to the password that is not hashed. If they match, true is returned. Otherwise, false is returned with any unexpected errors.
Click to show internal directories.
Click to hide internal directories.