Package bcrypt implements Provos and Mazières's bcrypt adaptive hashing algorithm. See http://www.usenix.org/event/usenix99/provos/provos.pdf
- func CompareHashAndPassword(hashedPassword, password byte) error
- func GenerateFromPassword(password byte, cost int) (byte, error)
- type HashVersionTooNewError
- type InvalidCostError
- type InvalidHashPrefixError
The error returned from CompareHashAndPassword when a hash is too short to be a bcrypt hash.
The error returned from CompareHashAndPassword when a password and hash do not match.
func CompareHashAndPassword ¶
CompareHashAndPassword compares a bcrypt hashed password with its possible plaintext equivalent. Note: Using bytes.Equal for this job is insecure. Returns nil on success, or an error on failure.
func GenerateFromPassword ¶
GenerateFromPassword returns the bcrypt hash of the password at the given cost. If the cost given is less than MinCost, the cost will be set to MinCost, instead. Use CompareHashAndPassword, as defined in this package, to compare the returned hashed password with its cleartext version.
type HashVersionTooNewError ¶
type HashVersionTooNewError byte
The error returned from CompareHashAndPassword when a hash was created with a bcrypt algorithm newer than this implementation.
type InvalidCostError ¶
type InvalidCostError int