Files
kenaito-conf/server/internal/util/encrypt.go
T

12 lines
371 B
Go

package util
import "golang.org/x/crypto/bcrypt"
func HashPassword(password string) (string, error) {
fromPassword, err := bcrypt.GenerateFromPassword([]byte(password), bcrypt.DefaultCost)
return string(fromPassword), err
}
func VerifyPassword(hashedPassword, password string) error {
return bcrypt.CompareHashAndPassword([]byte(hashedPassword), []byte(password))
}