Class PasswordEncoder
java.lang.Object
com.serinity.accesscontrol.util.PasswordEncoder
Utility class for securely encoding and verifying passwords.
This class provides static methods to encode plain-text passwords using
the BCrypt hashing algorithm and to verify passwords against their
hashed counterparts.
Important: This class is final and has a private
constructor to prevent instantiation, as it is intended to be a pure
utility class.
// Example usage
String hashed = PasswordEncoder.encode("mySecretPassword");
boolean matches = PasswordEncoder.isConfirmPassword("mySecretPassword", hashed);
This class is suitable for storing password hashes securely in databases and for verifying user-provided passwords during authentication.
- Since:
- 2026-02-03
- Version:
- 1.1
- Author:
- @ZouariOmar (zouariomar20@gmail.com)
- See Also:
-
Method Summary
-
Method Details
-
encode
-
isConfirmPassword
Verifies if a plain-text password matches a previously encoded hash.- Parameters:
passwd- the plain-text password to verifyconfirmPasswd- the previously hashed password- Returns:
trueif the plain-text password matches the hash,falseotherwise
-