Search code examples
spring-security

What encryption algorithm does Spring Security's PasswordEncoder use?


As the title says, I want to know what type of algorithm is used. I'm asking because I've been looking through Spring's official documentation and can't find a description of the algorithm.

I need an explanation of the algorithm type.

Thank you.


Solution

  • The PasswordEncoder interface in Spring offers various implementations, each utilizing a different cryptographic algorithm. The algorithm employed can often be inferred from the implementation class name.

    For instance:

    BCryptPasswordEncoder uses the bcrypt algorithm. Argon2PasswordEncoder employs the Argon2 algorithm. ...

    If you don't have a specific preference, it's advisable to opt for bcrypt. BCrypt is extensively utilized and is the default password encoder for Spring Security.