password

package module
v0.0.0-...-1077ceb Latest Latest
Warning

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

Go to latest
Published: Apr 6, 2024 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Compare

func Compare(hashedPassword, password string) bool

func Generate

func Generate(password string) (string, error)

func MustGenerate

func MustGenerate(password string) string

Types

type Argon2

type Argon2 struct {
	Time, Memory uint32
	Threads      uint8
	KeyLen       uint32
}

func (Argon2) Compare

func (a Argon2) Compare(hashedPassword, password string) bool

func (Argon2) Generate

func (a Argon2) Generate(password string) (string, error)

func (Argon2) MustGenerate

func (a Argon2) MustGenerate(password string) string

type Generator

type Generator interface {
	MustGenerate(password string) string
	Generate(password string) (string, error)
	Compare(hashedPassword, password string) bool
}

Generator is an interface that implements the Generate function. This is useful for testing where you can pass this interface instead of a real password generator to mock responses for predictability.

func New

func New() Generator

Jump to

Keyboard shortcuts

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