Initial commit: AIGC项目完整代码
This commit is contained in:
25
demo/PasswordChecker.java
Normal file
25
demo/PasswordChecker.java
Normal file
@@ -0,0 +1,25 @@
|
||||
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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user