hasher

package
v0.0.0-...-daa638b Latest Latest
Warning

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

Go to latest
Published: Sep 13, 2021 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Argon2

type Argon2 struct {
	Params *Argon2Params
}

func (*Argon2) Compare

func (h *Argon2) Compare(hashedPassword, password string) error

func (*Argon2) Hash

func (h *Argon2) Hash(password string) ([]byte, error)

type Argon2Params

type Argon2Params struct {
	Memory      uint32
	Iterations  uint32
	Parallelism uint8
	SaltLength  uint32
	KeyLength   uint32
}

func (*Argon2Params) Defaults

func (p *Argon2Params) Defaults()

type Bcrypt

type Bcrypt struct {
	Cost int
}

func (*Bcrypt) Compare

func (h *Bcrypt) Compare(hashedPassword, password string) error

func (*Bcrypt) Hash

func (h *Bcrypt) Hash(password string) ([]byte, error)

type Hasher

type Hasher interface {
	Hash(password string) ([]byte, error)
	Compare(hashedPassword, password string) error
}

func NewArgon2

func NewArgon2(argon2Params ...*Argon2Params) Hasher

func NewBcrypt

func NewBcrypt(cost ...int) Hasher

Jump to

Keyboard shortcuts

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