2025-10-21 16:50:33 +08:00
|
|
|
import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder;
|
|
|
|
|
|
|
|
|
|
public class PasswordChecker {
|
|
|
|
|
public static void main(String[] args) {
|
|
|
|
|
BCryptPasswordEncoder encoder = new BCryptPasswordEncoder();
|
|
|
|
|
String hash = "$2a$10$N.zmdr9k7uOCQb376NoUnuTJ8iAt6Z5EHsM8lE9lBOsl7iKTVEFDi";
|
|
|
|
|
|
|
|
|
|
// 测试不同的密码
|
|
|
|
|
String[] passwords = {"demo", "admin", "password", "123456"};
|
|
|
|
|
|
|
|
|
|
for (String password : passwords) {
|
|
|
|
|
boolean matches = encoder.matches(password, hash);
|
|
|
|
|
System.out.println("Password '" + password + "' matches: " + matches);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2025-10-22 09:50:11 +08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2025-10-23 09:59:54 +08:00
|
|
|
|
|
|
|
|
|
2025-10-24 09:31:26 +08:00
|
|
|
|
|
|
|
|
|
2025-11-03 10:55:48 +08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2025-10-27 10:46:49 +08:00
|
|
|
|
|
|
|
|
|
2025-10-29 10:16:03 +08:00
|
|
|
|
|
|
|
|
|