Package com.codingchili.core.security
Class ArgonSettings
java.lang.Object
com.codingchili.core.security.ArgonSettings
Contains default argon2 parameters for password hashing.
These can be configured in the
Configurations.security()
.
Please note that these settings will only be used when creating new hashes, for verifying old hashes the parameters encoded in the hash will be used instead.
These defaults are tuned to hash/verify in approximately 10ms on a recent desktop CPU. The parameters must be tuned to incur the most affordable time penalty for maximum security.
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionint
int
int
int
int
void
setHashLength(int hashLength)
void
setIterations(int iterations)
void
setMemory(int memory)
void
setParallelism(int parallelism)
void
setSaltLength(int saltLength)
-
Constructor Details
-
ArgonSettings
public ArgonSettings()
-
-
Method Details
-
getIterations
public int getIterations()- Returns:
- the number of iterations to perform when hashing.
-
setIterations
public void setIterations(int iterations)- Parameters:
iterations
- the number of iterations to perform when hashing. More iterations requires more processing power to verify.
-
getMemory
public int getMemory()- Returns:
- the memory requirements for hashing in kibibytes.
-
setMemory
public void setMemory(int memory)- Parameters:
memory
- the memory requirements for hashing in kibibytes, more memory means that ASICs will perform worse. At least while memory is expensive.
-
getParallelism
public int getParallelism()- Returns:
- the number of threads to use for computation.
-
setParallelism
public void setParallelism(int parallelism)- Parameters:
parallelism
- the number of threads for computation.
-
getHashLength
public int getHashLength()- Returns:
- the total length of the generated hash in bytes.
-
setHashLength
public void setHashLength(int hashLength)- Parameters:
hashLength
- set the length of the hash in bytes.
-
getSaltLength
public int getSaltLength()- Returns:
- the length of the generated salt in bytes.
-
setSaltLength
public void setSaltLength(int saltLength)- Parameters:
saltLength
- the length of the generated salt in bytes.
-