Initial commit of ld-sysinfo-server backend
This commit is contained in:
13
src/test/java/BcryptTest.java
Normal file
13
src/test/java/BcryptTest.java
Normal file
@@ -0,0 +1,13 @@
|
||||
import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder;
|
||||
|
||||
public class BcryptTest {
|
||||
public static void main(String[] args) {
|
||||
BCryptPasswordEncoder passwordEncoder = new BCryptPasswordEncoder(12); // 🔹 Make sure this matches DB cost
|
||||
|
||||
String plainTextPassword = "testpassword";
|
||||
String storedHash = "$2a$12$KcgrvENUeElvUiIVocp6LuJjrTXuKIG8nMbbca/8O.uQ6IdG0X7cO"; // Use latest hash
|
||||
|
||||
boolean matches = passwordEncoder.matches(plainTextPassword, storedHash);
|
||||
System.out.println("✅ Password Matches: " + matches);
|
||||
}
|
||||
}
|
||||
11
src/test/java/GenerateBcryptHash.java
Normal file
11
src/test/java/GenerateBcryptHash.java
Normal file
@@ -0,0 +1,11 @@
|
||||
import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder;
|
||||
|
||||
public class GenerateBcryptHash {
|
||||
public static void main(String[] args) {
|
||||
BCryptPasswordEncoder passwordEncoder = new BCryptPasswordEncoder(12);
|
||||
String plainTextPassword = "testpassword";
|
||||
String bcryptHash = passwordEncoder.encode(plainTextPassword);
|
||||
|
||||
System.out.println("🔹 New BCrypt Hash: " + bcryptHash);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user