package
Version:
v0.1.6
Opens a new window with list of versions in this module.
Published: May 2, 2026
License: MIT
Opens a new window with license information.
Imports: 1
Opens a new window with list of imports.
Imported by: 0
Opens a new window with list of known importers.
Documentation
¶
Package password provides secure password hashing and verification using bcrypt.
Hash generates a bcrypt hash from a plain-text password.
Uses bcrypt.DefaultCost (currently 10) for a good balance of security and performance.
Example:
hash, err := password.Hash("mysecretpassword")
if err != nil {
log.Fatal(err)
}
// Store hash in database
Verify checks if a plain-text password matches a bcrypt hash.
Returns true if the password matches, false otherwise.
Example:
if password.Verify("mysecretpassword", storedHash) {
// Password is correct
}
Source Files
¶
Click to show internal directories.
Click to hide internal directories.