Implement bcrypt

This commit is contained in:
2016-12-20 15:15:33 +01:00
parent cf03726643
commit b9d428d386
4 changed files with 29 additions and 5 deletions

15
bcrypt/verifier.go Normal file
View 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))
}