package main

import (
	"fmt"

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

func main() {
	hash, err := GenerateHash("Admin@2025!", "gohorse-pepper")
	if err != nil {
		fmt.Printf("Error: %v\n", err)
		return
	}

	fmt.Printf("-- New hash for superadmin (password: Admin@2025!, pepper: gohorse-pepper)\n")
	fmt.Printf("UPDATE users SET password_hash = '%s' WHERE identifier = 'superadmin';\n", hash)
}

func GenerateHash(password, pepper string) (string, error) {
	passwordWithPepper := password + pepper
	hash, err := bcrypt.GenerateFromPassword([]byte(passwordWithPepper), bcrypt.DefaultCost)
	if err != nil {
		return "", err
	}
	return string(hash), nil
}
