hash

package
v1.0.7 Latest Latest
Warning

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

Go to latest
Published: Nov 3, 2024 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	Argon2idTime    = uint32(4)
	Argon2idMemory  = uint32(65536)
	Argon2idThreads = uint8(1)
)
View Source
var (
	BcryptRounds = 12
)
View Source
var (
	DefaultHasher = NewBcrypt()
)

Functions

This section is empty.

Types

type Argon2id

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

func (*Argon2id) Check

func (a *Argon2id) Check(value, hash string) bool

func (*Argon2id) Make

func (a *Argon2id) Make(value string) (string, error)

func (*Argon2id) NeedsRehash

func (a *Argon2id) NeedsRehash(hash string) bool

type Bcrypt

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

func (*Bcrypt) Check

func (b *Bcrypt) Check(value, hash string) bool

Check checks if the given string matches the given hash.

func (*Bcrypt) Make

func (b *Bcrypt) Make(value string) (string, error)

Make returns the hashed value of the given string.

func (*Bcrypt) NeedsRehash

func (b *Bcrypt) NeedsRehash(hash string) bool

NeedsRehash checks if the given hash needs to be rehashed.

type Hasher added in v1.0.3

type Hasher interface {
	Make(value string) (string, error)
	Check(value, hash string) bool
	NeedsRehash(hash string) bool
}

func NewArgon2id

func NewArgon2id() Hasher

NewArgon2id returns a new Argon2id hasher.

func NewBcrypt

func NewBcrypt() Hasher

NewBcrypt returns a new Bcrypt hasher.

Jump to

Keyboard shortcuts

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