- Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathTestPassword.java
More file actions
Latest commit
16 lines (13 loc) · 665 Bytes
/
Copy pathTestPassword.java
File metadata and controls
16 lines (13 loc) · 665 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
importorg.springframework.security.crypto.bcrypt.BCryptPasswordEncoder;
publicclassTestPassword {
publicstaticvoidmain(String[] args) {
BCryptPasswordEncoderencoder = newBCryptPasswordEncoder(12);
Stringpassword = "Admin@123";
Stringhash = "$2a$12$HJGGn88yNAarmw4TynLFUu4NVntTMOtf8mePP0nBQZ7LTgTHeJlba";
booleanmatches = encoder.matches(password, hash);
System.out.println("Password 'Admin@123' matches hash: " + matches);
// Generate a new hash to verify
StringnewHash = encoder.encode(password);
System.out.println("New hash for 'Admin@123': " + newHash);
}
}