package auth

import (
	"golang.org/x/crypto/bcrypt"
)

var bcryptCost = bcrypt.DefaultCost

func HashPassword(plain string) ([]byte, error) {
	return bcrypt.GenerateFromPassword([]byte(plain), bcryptCost)
}

func VerifyPassword(hash []byte, plain string) bool {
	err := bcrypt.CompareHashAndPassword(hash, []byte(plain))
	return err == nil
}
