Documentation
¶
Overview ¶
Package bcrypt implements a Django compatible bcrypt algorithm.
This is considered by many to be the most secure algorithm.
This library does not allow to set custom salt as in the Django algorithm. If you encode the same password multiple times you will get different hashes. This limitation comes from "golang.org/x/crypto/bcrypt" library.
A future release of this library may add support to custom salt.
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ( ErrHashComponentMismatch = errors.New("unchained/bcrypt: hashed password components mismatch") ErrAlgorithmMismatch = errors.New("unchained/bcrypt: algorithm mismatch") )
Errors returned by BCryptHasher.
Functions ¶
This section is empty.
Types ¶
type BCryptHasher ¶
type BCryptHasher struct { // Algorithm identifier. Algorithm string // Defines the hash function used to avoid bcrypt's 72 bytes password truncation. Digest func() hash.Hash // Defines the number of rounds used to encode the password. Cost int }
BCryptHasher implements Bcrypt password hasher.
func NewBCryptHasher ¶
func NewBCryptHasher() *BCryptHasher
NewBCryptHasher secures password hashing using the bcrypt algorithm.
This hasher does not first hash the password which means it is subject to bcrypt's 72 bytes password truncation.
func NewBCryptSHA256Hasher ¶
func NewBCryptSHA256Hasher() *BCryptHasher
NewBCryptSHA256Hasher secures password hashing using the bcrypt algorithm.
This hasher first hash the password with SHA-256.