Documentation
¶
Overview ¶
Package pwhash is a simple to use password hashing library. The defaults are set to be good for most purposes and it is backwards compatible with older password hashing schemes.
Index ¶
Examples ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Hash ¶
Hash returns a hashed version of the given password. Use this when the user enters a new password and store it as an opaque string in a database.
You don't need to salt or do this operation multiple times, this is all handled for you.
Example ¶
hash := Hash("correct horse battery staple") fmt.Println("hash:", hash) fmt.Println("verify:", Verify("correct horse battery staple", hash)) fmt.Println("verify:", Verify("Tr0ub4dor&3", hash))
Output:
func Verify ¶
Verify check whether a given password matches the hash. Use it for example this way:
hash := loadUser(username).hash if !pwhash.Verify(password, hash) { // login unsuccessful return ... } // continue with logged in user
This function accepts multiple hash formats for backwards compatibility.
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.