Implement bcrypt
This commit is contained in:
15
bcrypt/verifier.go
Normal file
15
bcrypt/verifier.go
Normal file
@ -0,0 +1,15 @@
|
||||
package bcrypt
|
||||
|
||||
import (
|
||||
"golang.org/x/crypto/bcrypt"
|
||||
)
|
||||
|
||||
// Verifier verifys passwords using Bcrypt
|
||||
type Verifier struct {
|
||||
cost int
|
||||
}
|
||||
|
||||
// Verify verifys a Password
|
||||
func (bv *Verifier) Verify(password string, hashOnDb string) error {
|
||||
return bcrypt.CompareHashAndPassword([]byte(hashOnDb), []byte(password))
|
||||
}
|
Reference in New Issue
Block a user