argon2id

package
v1.0.1 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrInvalidHash = errors.New("invalid hash")

ErrInvalidHash is returned when an invalid hash is provided.

Functions

func Verify

func Verify(password []byte, hash *Hash) bool

Verify verifies the given password against the given Argon2ID hash. Returns true if the password matches the hash, false otherwise.

Types

type Hash

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

Hash represents the Argon2ID hash.

func Decode

func Decode(encodedHash string) (*Hash, error)

Decode decodes an Argon2ID hash from a string representation.

func (*Hash) Encode

func (hash *Hash) Encode() string

Encode encodes the Argon2ID hash into a string representation.

type Hasher

type Hasher struct {
	Memory      uint32
	Iterations  uint32
	Parallelism uint8
	HashLength  uint32
}

Hasher represents an Argon2ID hasher.

func (*Hasher) Hash

func (hasher *Hasher) Hash(password []byte, salt []byte) Hash

Hash computes the Argon2ID hash of the given password and salt.

Jump to

Keyboard shortcuts

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