public abstract class AbstractPasswordHashCreatorPBKDF2 extends AbstractPasswordHashCreator
IPasswordHashCreator using the PBKDF2 algorithm.| Modifier and Type | Field and Description |
|---|---|
protected int |
m_nHashBytes |
protected int |
m_nIterations |
protected String |
m_sPBKDF2AlgorithmName |
| Constructor and Description |
|---|
AbstractPasswordHashCreatorPBKDF2(String sAlgorithmName,
String sPBKDF2AlgorithmName,
int nIterations,
int nBytes) |
| Modifier and Type | Method and Description |
|---|---|
String |
createPasswordHash(IPasswordSalt aSalt,
String sPlainTextPassword)
The method to create a message digest hash from a password.
|
protected static byte[] |
pbkdf2(char[] aPassword,
byte[] aSalt,
int nIterations,
int nBytes,
String sPBKDF2AlgorithmName)
Computes the PBKDF2 hash of a password.
|
boolean |
requiresSalt() |
getAlgorithmName, toStringprotected final String m_sPBKDF2AlgorithmName
protected final int m_nIterations
protected final int m_nHashBytes
public AbstractPasswordHashCreatorPBKDF2(@Nonnull @Nonempty String sAlgorithmName, @Nonnull @Nonempty String sPBKDF2AlgorithmName, @Nonnegative int nIterations, @Nonnegative int nBytes)
public final boolean requiresSalt()
true if this hash creator requires a salt,
false if not.@Nonnull protected static final byte[] pbkdf2(@Nonnull char[] aPassword, @Nonnull byte[] aSalt, @Nonnegative int nIterations, @Nonnegative int nBytes, @Nonnull @Nonempty String sPBKDF2AlgorithmName)
aPassword - the password to hash.aSalt - the saltnIterations - the iteration count (slowness factor)nBytes - the length of the hash to compute in bytessPBKDF2AlgorithmName - The SecretKeyFactory parameter to use. May neither be
null nor empty.@Nonnull public String createPasswordHash(@Nonnull IPasswordSalt aSalt, @Nonnull String sPlainTextPassword)
IPasswordHashCreatoraSalt - Optional salt to be used. This parameter is only null
for backwards compatibility reasons.sPlainTextPassword - Plain text password. May not be null.Copyright © 2016–2021 Philip Helger. All rights reserved.