Documentation
¶
Overview ¶
Package pwdhash manages password hashing via configurable algorithms.
Package pwdhash manages password hashing via configurable algorithms.
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ( // ErrInvalidHash indicates that an encoded hash cannot be parsed. ErrInvalidHash = errors.New("invalid encoded hash") )
Functions ¶
This section is empty.
Types ¶
type Hasher ¶
type Hasher interface {
ID() string
Hash(password []byte) (string, error)
Verify(password []byte, encoded string) (bool, error)
NeedsRehash(encoded string) (bool, error)
}
Hasher represents a password hashing algorithm implementation.
type Option ¶
type Option func(*config)
Option configures PasswordHasher construction.
func WithHasher ¶
WithHasher overrides the default hashing algorithm.
type PasswordHasher ¶
type PasswordHasher struct {
// contains filtered or unexported fields
}
PasswordHasher manages password hashing operations via registered algorithms.
func New ¶
func New(opts ...Option) (*PasswordHasher, error)
New constructs a PasswordHasher configured via the provided options.
func (*PasswordHasher) Hash ¶
func (p *PasswordHasher) Hash(password []byte) (string, error)
Hash encodes the provided password using the active hasher.
func (*PasswordHasher) NeedsRehash ¶
func (p *PasswordHasher) NeedsRehash(encoded string) (bool, error)
NeedsRehash reports whether the encoded hash should be regenerated.
Directories
¶
| Path | Synopsis |
|---|---|
|
Package argon2 contains the Argon2id hasher implementation.
|
Package argon2 contains the Argon2id hasher implementation. |
|
internal
|
|
|
cast
Package cast provides narrow numeric conversion helpers.
|
Package cast provides narrow numeric conversion helpers. |
|
encoding
Package encoding handles serialization and parsing of PHC strings.
|
Package encoding handles serialization and parsing of PHC strings. |
|
subtle
Package subtle provides wrappers for constant-time operations.
|
Package subtle provides wrappers for constant-time operations. |
Click to show internal directories.
Click to hide internal directories.