package utils import ( "strconv" "golang.org/x/crypto/bcrypt" ) func HashPassword(password string) (string, error) { bytes, err := bcrypt.GenerateFromPassword([]byte(password), 14) return string(bytes), err } func CheckPasswordHash(password, hash string) bool { err := bcrypt.CompareHashAndPassword([]byte(hash), []byte(password)) return err == nil } func StringToUint(s string) uint { id, err := strconv.ParseUint(s, 10, 64) if err != nil { return 0 } return uint(id) }