I read about BCryptPasswordEncoder here and I don't understand why this would be used rather than a hash+salt, there is no secret key involved all it takes to for an attacker to crack it is gaining access to the hash and using the algorithm's decode. I thought hash+salting required an external key as the additional layer of security so an attacker would require 2 pieces, the hash and the key.
Or are you suppose to use this then the salt in addition?
All the attacker has to do is run the .match with a password if they obtain the hash
BCryptPasswordEncoder passwordEncoder = new BCryptPasswordEncoder();
String password = ... // Password entered by user
String dbPassword = ... // Load hashed DB password
if (passwordEncoder.matches(password, dbPassword)) {
}
But with a key not stored in the hash an attacker wouldn't be able to just run a decoder against a string they'd need the external key. So how is this more secure than using an external key?