Documentation ¶
Overview ¶
Package argon2id provides some helper functions around hashing and comparing password hashes using Argon2id.
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ErrInvalidArgon2Version = fmt.Errorf("synacor/argon2id: argon2 version is not %d", argon2.Version)
ErrInvalidArgon2Version is an error when the version in the hashed password does not match the version supplied by the golang.org/x/crypto/argon2 library
var ErrInvalidComplexity = errors.New("synacor/argon2id: the hashed password has invalid complexity values")
ErrInvalidComplexity is an error when a complexity value (time, memory, threads) is too large
var ErrInvalidHash = errors.New("synacor/argon2id: the hashed password is not a valid hash")
ErrInvalidHash is an error when the hashed password does not match the proper pattern
var ErrMismatchedHashAndPassword = errors.New("synacor/argon2id: hashedPassword is not the hash of the given password")
ErrMismatchedHashAndPassword is an error when the password does not hash to the hashedPassword value
Functions ¶
func Compare ¶
Compare will compare the hashedPassword with the supplied password. If unsuccessful, an error will be returned. On success, error is nil.
func DefaultHashPassword ¶
DefaultHashPassword is a convenience function that calls HashPassword() with default values
func HashPassword ¶
func HashPassword(password string, time, memory uint32, threads uint8, keyLen uint32) (string, error)
HashPassword will hash the password. If time, memory, threads or keyLen is "0", then a sane default will be used.
func IsHashedPassword ¶
IsHashedPassword will return true if hashedPassword is a proper password hashed by this library
Types ¶
This section is empty.