hash

package
v0.1.3 Latest Latest
Warning

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

Go to latest
Published: Jun 2, 2024 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Argon

type Argon struct {
	Memory      uint32
	Iterations  uint32
	Parallelism uint8
	Salt        []byte
	Key         []byte
}

Argon represents a password has created using Argon2ID key derivation

func (*Argon) HashPassword

func (a *Argon) HashPassword(password string) (Hash, error)

HashPassword creates a new password hash for the given password, using the parameters from this hash (including salt)

func (*Argon) Matches

func (a *Argon) Matches(password string) bool

Matches checks if the given password corresponds to the hash

func (*Argon) String

func (a *Argon) String() string

type Hash

type Hash interface {
	String() string
	// HashPassword creates a new password hash for the given password, using the parameters from this hash
	// (including salt)
	HashPassword(string) (Hash, error)
	// Matches checks if the given password corresponds to the hash
	Matches(string) bool
}

func FromString

func FromString(str string) (Hash, error)

FromString tries to read a hashed password from its string representation The stored hash has to be encoded by any of the functions supported by PartMATE (currently Argon2ID)

func NewArgon

func NewArgon(password string) (Hash, error)

NewArgon uses the given password and creates its hashed version - using the default parameters and a newly generated salt

Jump to

Keyboard shortcuts

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