Documentation
¶
Overview ¶
Package password hashes and verifies user passwords with the standard-library PBKDF2 implementation. Encoded hashes carry their parameters so applications can increase work over time without invalidating existing credentials.
Index ¶
Constants ¶
View Source
const (
DefaultIterations = 600_000
)
Variables ¶
View Source
var ErrInvalidHash = errors.New("invalid password hash")
Functions ¶
This section is empty.
Types ¶
type Hasher ¶
type Hasher struct {
// Iterations controls newly created hashes. Nonpositive values use the
// default; Hash rejects values above 10,000,000, the verification limit.
Iterations int
}
func (Hasher) DummyVerify ¶
DummyVerify performs equivalent expensive work for unknown-user login paths, reducing the usefulness of account-enumeration timing differences.
func (Hasher) NeedsRehash ¶
func (Hasher) VerifyCurrent ¶ added in v0.8.0
VerifyCurrent verifies an encoded password and, on mismatch, pads hashes created with an older policy to the current iteration budget. Login handlers should use this method so a failed attempt cannot identify accounts that are still awaiting transparent rehashing.
Click to show internal directories.
Click to hide internal directories.