bcrypt

package
v0.0.0-...-ace544b Latest Latest
Warning

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

Go to latest
Published: Dec 22, 2022 License: MIT Imports: 1 Imported by: 0

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.

Jump to

Keyboard shortcuts

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