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); } }