Discover Packages
github.com/MetalBlockchain/metalgo
utils
password
package
Version:
v1.11.1-rc.1
Opens a new window with list of versions in this module.
Published: Apr 4, 2024
License: BSD-3-Clause
Opens a new window with license information.
Imports: 6
Opens a new window with list of imports.
Imported by: 1
Opens a new window with list of known importers.
Documentation Source Files Index Constants Variables Functions Types IsValid(password, minimumStrength) SufficientlyStrong(password, minimumStrength) type Hash type Strength (h) Check(password) (h) Set(password)
Documentation
¶
View Source
const (
VeryWeak = 0
Weak = 1
Fair = 2
Strong = 3
VeryStrong = 4
OK = Fair
)
View Source
var (
ErrEmptyPassword = errors .New ("empty password")
ErrPassMaxLength = fmt .Errorf ("password exceeds maximum length of %d chars", maxPassLen)
ErrWeakPassword = errors .New ("password is too weak")
)
IsValid returns nil if password is a reasonable length and has strength
greater than or equal to [minimumStrength]
SufficientlyStrong returns true if password has strength greater than or
equal to [minimumStrength]
type Hash struct {
Password [32]byte `serialize:"true"`
Salt [16]byte `serialize:"true"`
}
Hash of a password
Check returns true iff the provided password was the same as the last
password set.
Set updates the password hash to be of the provided password
Strength is the strength of a password
Source Files
¶
Click to show internal directories.
Click to hide internal directories.