Documentation ¶
Overview ¶
Package password provides functions for hashing and verifying passwords.
Example usage: hashedPassword, err := password.Hash("mysecretpassword") isValid, err := password.Matches("mysecretpassword", hashedPassword)
Index ¶
Constants ¶
View Source
const ( // MinCost is the minimum bcrypt cost factor MinCost = bcrypt.MinCost // 4 // MaxCost is the maximum bcrypt cost factor MaxCost = bcrypt.MaxCost // 31 // DefaultCost is the default cost factor used if not specified // or if specified cost is invalid DefaultCost = 12 // RecommendedMinCost is the recommended minimum cost for production use RecommendedMinCost = 10 )
Variables ¶
View Source
var ( // ErrEmptyPassword indicates that an empty password was provided ErrEmptyPassword = errors.New("password cannot be empty") // ErrEmptyHash indicates that an empty hash was provided for verification ErrEmptyHash = errors.New("hash cannot be empty") )
View Source
var CommonPasswords = []string{}/* 10000 elements not displayed */
CommonPasswords list is from https://github.com/danielmiessler/SecLists/blob/master/Passwords/Common-Credentials/10k-most-common.txt
Functions ¶
func Cost ¶
Cost returns the cost factor used to create the given hash Returns an error if the hash is invalid or empty
Types ¶
Click to show internal directories.
Click to hide internal directories.