Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ErrInvalidPasswordHash = errors.New("crypto: invalid password hash")
ErrInvalidPasswordHash is returned by VerifyPassword when the stored PHC string cannot be parsed. Callers should treat this as a server-side fault, not a credential mismatch.
Functions ¶
func HashPassword ¶ added in v0.2.0
HashPassword returns an argon2id PHC-formatted hash of the plain password. Format:
$argon2id$v=19$m=<KiB>,t=<iters>,p=<threads>$<base64(salt)>$<base64(hash)>
Salt is freshly random per call — two hashes of the same password differ.
func VerifyPassword ¶ added in v0.2.0
VerifyPassword parses the PHC string and constant-time-compares the supplied plain password against it. Returns (true, nil) on match, (false, nil) on mismatch, and (false, ErrInvalidPasswordHash) on a malformed hash.
Types ¶
This section is empty.