bcrypt

package
v0.5.0 Latest Latest
Warning

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

Go to latest
Published: Jan 9, 2024 License: BSD-3-Clause Imports: 3 Imported by: 0

Documentation

Index

Constants

View Source
const (
	Identifier = "2"
	Prefix     = "$" + Identifier
)

Identifier and prefix used by Bcrypt

View Source
const (
	MinCost     = bcrypt.MinCost
	MaxCost     = bcrypt.MaxCost
	DefaultCost = bcrypt.DefaultCost
)

Variables

Verifier for Bcrypt.

View Source
var (
	Versions = [...]byte{'a', 'b', 'y'}
)

Versions of the Bcrypt implementation.

Functions

func Verify

func Verify(encoded, password string) (verifier.Result, error)

Verify parses encoded and uses its bcrypt parameters to verify password against its hash.

Types

type Hasher

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

Hasher hashes and verifies bcrypt passwords.

func New

func New(cost int) *Hasher

New will return a Hasher with cost as bcrypt parameter.

func (*Hasher) Hash

func (h *Hasher) Hash(password string) (string, error)

Hash implements passwap.Hasher.

func (*Hasher) Verify

func (h *Hasher) Verify(encoded, password string) (verifier.Result, error)

Verify implements passwap.Verifier

Jump to

Keyboard shortcuts

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