public class HashConfig extends CryptoAlgorithmConfig implements AbstractGetIterationCount, HashFactory
| Modifier and Type | Field and Description |
|---|---|
static String |
ALGORITHM_NONE
The dummy hash algorithm NONE for no hashing (e.g.
|
private int |
iterationCount |
algorithmprovider| Constructor and Description |
|---|
HashConfig(String algorithm)
The constructor.
|
HashConfig(String algorithm,
int iterationCount)
The constructor.
|
HashConfig(String algorithm,
SecurityProvider provider)
The constructor.
|
HashConfig(String algorithm,
SecurityProvider provider,
int iterationCount)
The constructor.
|
| Modifier and Type | Method and Description |
|---|---|
HashConfig |
decrementIterationCount() |
int |
getIterationCount() |
HashAccess |
newAccess() |
HashCreator |
newHashCreator() |
getAlgorithmgetProviderpublic static final String ALGORITHM_NONE
private final int iterationCount
public HashConfig(String algorithm)
algorithm - the hash algorithm.public HashConfig(String algorithm, int iterationCount)
algorithm - the hash algorithm.iterationCount - the iteration count.public HashConfig(String algorithm, SecurityProvider provider)
algorithm - the hash algorithm.provider - the SecurityProvider.public HashConfig(String algorithm, SecurityProvider provider, int iterationCount)
algorithm - the hash algorithm.provider - the SecurityProvider.iterationCount - the iteration count.public int getIterationCount()
getIterationCount in interface AbstractGetIterationCountalgorithm such as a hash function. A value of 1 means that
the algorithm is applied only a single time. This can be fine for simple hashing. Any higher number means
an according repetition of the algorithm. The higher the number the higher the computation time. While e.g.
for password checks a high iteration count may only mean an overhead of roughly one second, an attacker who
wants to try every password with a brute force attack will require an extra ordinary magnitude of
additional computing power. Therefore in case of a password algorithm such as PBKDF2 a higher number will
mean higher security. However, the value is always a trade-off between usability and security. Further, a
too high number might even open the door to denial of service attacks (DoS). A good value can only be
defined for a particular algorithm in combination of the current hardware resources and computation power
that increase over time.PBEKeySpec.getIterationCount()public HashConfig decrementIterationCount()
HashConfig with the same algorithm but an iteration count decreased by 1. If the iteration count is already 1
then null is returned.public HashAccess newAccess()
HashAccess for this configuration.public HashCreator newHashCreator()
newHashCreator in interface HashFactoryHashCreator for the configured hash algorithm of this factory.Copyright © 2001–2019 mmm-Team. All rights reserved.