bcrypt

package
v0.0.0-...-9a64e19 Latest Latest
Warning

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

Go to latest
Published: Feb 2, 2023 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

View Source
const (
	MinCost     int = 4  // the minimum allowable cost as passed in to Encode string
	MaxCost     int = 31 // the maximum allowable cost as passed in to Encode string
	DefaultCost int = 10 // the cost that will actually be set if a cost below MinCost is passed into Encode string
)

Variables

This section is empty.

Functions

func WithCost

func WithCost(cost int) types.Option

WithCost configure the cost for BcryptEncoder

Types

type Encoder

type Encoder struct {
	Cost int
	// contains filtered or unexported fields
}

func (*Encoder) Encode

func (e *Encoder) Encode(src string) (string, error)

Encode returns the hash value of the given data

func (*Encoder) GetSalt

func (e *Encoder) GetSalt() ([]byte, error)

GetSalt Returns the salt if present, otherwise nil

func (*Encoder) Verify

func (e *Encoder) Verify(hash, rawData string) (bool, error)

Verify compares a encoded data with its possible plaintext equivalent

Jump to

Keyboard shortcuts

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