package auth import "golang.org/x/crypto/bcrypt" const bcryptCost = 12 func HashPassword(password string) (string, error) { bytes, err := bcrypt.GenerateFromPassword([]byte(password), bcryptCost) return string(bytes), err } func VerifyPassword(password, hash string) bool { return bcrypt.CompareHashAndPassword([]byte(hash), []byte(password)) == nil }