argon2id

package
v0.0.5-dev Latest Latest
Warning

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

Go to latest
Published: Nov 10, 2023 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrInvalidHash         = errors.New("argon2id: the encoded hash is not in the correct format")
	ErrIncompatibleVariant = errors.New("argon2id: incompatible algorithm variant")
	ErrIncompatibleVersion = errors.New("argon2id: incompatible version of argon2")
)
View Source
var DefaultParams = &Params{
	Memory:      32 * 1024,
	Iterations:  2,
	Parallelism: 2,
	SaltLength:  16,
	KeyLength:   32,
}

Functions

func ComparePasswordAndHash

func ComparePasswordAndHash(password, hash string) (match bool, err error)

ComparePasswordAndHash performs a constant-time comparison between a plain-text password and Argon2id hash

func CreateHash

func CreateHash(password string, params *Params) (hash string, err error)

CreateHash returns a Argon2id hash of a plain-text password

Types

type Params

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

func CheckHash

func CheckHash(password, hash string) (match bool, params *Params, err error)

CheckHash is like ComparePasswordAndHash except that it also returns the parameters and salt used to create the hash.

func DecodeHash

func DecodeHash(hash string) (params *Params, salt, key []byte, err error)

DecodeHash decodes a hash string into its parameters, salt, and key.

Jump to

Keyboard shortcuts

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