package com.snack.server.utils;

import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder;

/**
 * BCrypt 密码生成工具（仅用于初始化数据 / 测试）
 * 使用方法：运行 main 方法，传入明文密码即可打印出 BCrypt hash
 */
public class PasswordGenerator {

    public static void main(String[] args) {
        BCryptPasswordEncoder encoder = new BCryptPasswordEncoder();
        String raw = args.length > 0 ? args[0] : "123456";
        String encoded = encoder.encode(raw);
        System.out.println("明文: " + raw);
        System.out.println("BCrypt: " + encoded);
        System.out.println("校验: " + encoder.matches(raw, encoded));
    }
}
