MCPcopy
hub / github.com/gtank/cryptopasta / CheckPasswordHash

Function CheckPasswordHash

hash.go:47–49  ·  view source on GitHub ↗

CheckPassword securely compares a bcrypt hashed password with its possible plaintext equivalent. Returns nil on success, or an error on failure.

(hash, password []byte)

Source from the content-addressed store, hash-verified

45// CheckPassword securely compares a bcrypt hashed password with its possible
46// plaintext equivalent. Returns nil on success, or an error on failure.
47func CheckPasswordHash(hash, password []byte) error {
48 return bcrypt.CompareHashAndPassword(hash, password)
49}

Callers 1

TestPasswordHashingFunction · 0.85

Calls

no outgoing calls

Tested by 1

TestPasswordHashingFunction · 0.68