argon2id

package module
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Apr 27, 2024 License: LGPL-3.0 Imports: 7 Imported by: 0

README

argon2id

Provide an API for handling argon2id password hashes.

argon2id provides a wrapper around golang.org/x/crypto/argon2 suitable for generating and checking passwords. Only the argon2id algorithm is supported.

GenerateFromPassword() will successfully generate a password hash using default values if any of time, mem, or threads are out of bounds; however, err != nil.

Documentation

Index

Constants

View Source
const (
	// Based on recommendations by OWASP.
	DefaultTime    uint32 = 4
	DefaultMem     uint32 = 9 * 1024 // in kilobytes
	DefaultThreads uint8  = 1
	DefaultKeyLen  uint32 = 32

	MaxRFC9106PasswdLen int = (2 << 31) - 1

	Prefix string = "an99"
)

Variables

View Source
var (
	ErrMismatchedHashAndPassword = errMismatchedHashAndPassword()
	ErrUnexpectedSaltSize        = errUnexpectedSaltSize()
	ErrInvalidTimeParm           = errInvalidTimeParm()
	ErrInvalidMemParm            = errInvalidMemParm()
	ErrInvalidThreadParm         = errInvalidThreadParm()
	ErrInvalidHashSigil          = errInvalidHashSigil()
	ErrPasswdTooLong             = errPasswdTooLong()
)

Functions

func CompareHashAndPassword

func CompareHashAndPassword(hashedPassword, password []byte) error

func GenerateFromPassword

func GenerateFromPassword(password []byte, time, mem uint32, threads uint8) ([]byte, error)

Types

This section is empty.

Jump to

Keyboard shortcuts

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