package com.bjtdba.userCenter.util;

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

public class PasswordUtil {

    private static final BCryptPasswordEncoder encoder = new BCryptPasswordEncoder();

    // 生成密码哈希（对应PHP的password_hash）
    public static String hashPassword(String password) {
        return encoder.encode(password);
    }

    // 验证密码（对应PHP的password_verify）
    public static boolean verifyPassword(String password, String hashedPassword) {
        return encoder.matches(password, hashedPassword);
    }
}