Class PasswordHashCreatorBCrypt
- java.lang.Object
-
- com.helger.security.password.hash.AbstractPasswordHashCreator
-
- com.helger.security.password.hash.PasswordHashCreatorBCrypt
-
- All Implemented Interfaces:
IPasswordHashCreator
public final class PasswordHashCreatorBCrypt extends AbstractPasswordHashCreator
The new default implementation ofIPasswordHashCreatorthat requires a salt and uses the BCrypt algorithm.- Author:
- Philip Helger
-
-
Constructor Summary
Constructors Constructor Description PasswordHashCreatorBCrypt()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description StringcreatePasswordHash(IPasswordSalt aSalt, String sPlainTextPassword)The method to create a message digest hash from a password.booleanrequiresSalt()-
Methods inherited from class com.helger.security.password.hash.AbstractPasswordHashCreator
getAlgorithmName, toString
-
-
-
-
Field Detail
-
ALGORITHM
public static final String ALGORITHM
- See Also:
- Constant Field Values
-
-
Method Detail
-
requiresSalt
public boolean requiresSalt()
- Returns:
trueif this hash creator requires a salt,falseif not.
-
createPasswordHash
@Nonnull public String createPasswordHash(@Nonnull IPasswordSalt aSalt, @Nonnull String sPlainTextPassword)
The method to create a message digest hash from a password. The password salt must be of typePasswordSaltBCrypt.- Parameters:
aSalt- Optional salt to be used. This parameter is onlynullfor backwards compatibility reasons.sPlainTextPassword- Plain text password. May not benull.- Returns:
- The String representation of the password hash. Must be valid to encode in UTF-8.
-
-