PBKDF2 is a Spring Security password encoder based on the password-based key derivation function 2. It provides a stronger password-hashing option than the deprecated StandardPasswordEncoder, which uses SHA-256. section 4.1.3
PasswordEncoder p =
new Pbkdf2PasswordEncoder("secret", 16, 310000, Pbkdf2PasswordEncoder. SecretKeyFactoryAlgorithm.PBKDF2WithHmacSHA256);
Configure a Pbkdf2PasswordEncoder with a secret, salt length, iteration count, and PBKDF2WithHmacSHA256 algorithm. section 4.1.3
Spring Security provides several password-encoder choices:
- Use Pbkdf2PasswordEncoder for PBKDF2-based password encoding. section 4.1.3
- Contrast it with BCryptPasswordEncoder and SCryptPasswordEncoder; avoid NoOpPasswordEncoder in real-world applications. section 4.1.3
