Package org.xwiki.crypto.password.params
Class ScryptParameters
- java.lang.Object
-
- org.xwiki.crypto.password.params.KeyDerivationFunctionParameters
-
- org.xwiki.crypto.password.params.ScryptParameters
-
public class ScryptParameters extends KeyDerivationFunctionParameters
Key derivation function parameters for Scrypt functions.- Since:
- 5.4M1
- Version:
- $Id: f332481ea566da301559c953d9bf38ef727517ad $
-
-
Constructor Summary
Constructors Constructor Description ScryptParameters()
ScryptParameters(int keySize)
ScryptParameters(int keySize, byte[] salt)
ScryptParameters(int keySize, int costParameter, int parallelizationParameter)
Initialize parameters to custom values, use a random salt and a block size of 8.ScryptParameters(int keySize, int costParameter, int parallelizationParameter, byte[] salt)
Initialize parameters to custom values and use a block size of 8.ScryptParameters(int keySize, int costParameter, int parallelizationParameter, int blockSize)
Initialize all parameters to custom values and use a random salt.ScryptParameters(int keySize, int costParameter, int parallelizationParameter, int blockSize, byte[] salt)
Initialize all parameters to custom values.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description String
getAlgorithmName()
int
getBlockSize()
int
getCostParameter()
int
getParallelizationParameter()
byte[]
getSalt()
-
Methods inherited from class org.xwiki.crypto.password.params.KeyDerivationFunctionParameters
getKeySize
-
-
-
-
Constructor Detail
-
ScryptParameters
public ScryptParameters()
-
ScryptParameters
public ScryptParameters(int keySize)
Initialize key size and use a random salt, a cost parameter of 1024, a parallelization parameter of 1 and a block size of 8.- Parameters:
keySize
- Size of key to be generated in bytes. A negative value means that the key length should be smartly deducted from the context of use.
-
ScryptParameters
public ScryptParameters(int keySize, byte[] salt)
Initialize parameters to custom values, a cost parameter of 1024, a parallelization parameter of 1 and a block size of 8.- Parameters:
keySize
- Size of key to be generated in bytes. A negative value means that the key length should be smartly deducted from the context of use.salt
- a salt.
-
ScryptParameters
public ScryptParameters(int keySize, int costParameter, int parallelizationParameter)
Initialize parameters to custom values, use a random salt and a block size of 8.- Parameters:
keySize
- Size of key to be generated in bytes. A negative value means that the key length should be smartly deducted from the context of use.costParameter
- CPU/Memory cost parameter, must be larger than 1, a power of 2.parallelizationParameter
- Parallelization parameter, a positive integer less than or equal to (2^37-32) / 1024
-
ScryptParameters
public ScryptParameters(int keySize, int costParameter, int parallelizationParameter, byte[] salt)
Initialize parameters to custom values and use a block size of 8.- Parameters:
keySize
- Size of key to be generated in bytes. A negative value means that the key length should be smartly deducted from the context of use.costParameter
- CPU/Memory cost parameter, must be larger than 1, a power of 2.parallelizationParameter
- Parallelization parameter, a positive integer less than or equal to (2^37-32) / 1024salt
- a salt.
-
ScryptParameters
public ScryptParameters(int keySize, int costParameter, int parallelizationParameter, int blockSize)
Initialize all parameters to custom values and use a random salt.- Parameters:
keySize
- Size of key to be generated in bytes. A negative value means that the key length should be smartly deducted from the context of use.costParameter
- CPU/Memory cost parameter, must be larger than 1, a power of 2 and less than 2^(16 * blockSize)parallelizationParameter
- Parallelization parameter, a positive integer less than or equal to (2^37-32) / (128 * blockSize)blockSize
- Block size parameter.
-
ScryptParameters
public ScryptParameters(int keySize, int costParameter, int parallelizationParameter, int blockSize, byte[] salt)
Initialize all parameters to custom values.- Parameters:
keySize
- Size of key to be generated in bytes. A negative value means that the key length should be smartly deducted from the context of use.costParameter
- CPU/Memory cost parameter, must be larger than 1, a power of 2 and less than 2^(16 * blockSize)parallelizationParameter
- Parallelization parameter, a positive integer less than or equal to (2^37-32) / (128 * blockSize)blockSize
- Block size parameter.salt
- a salt.
-
-
Method Detail
-
getAlgorithmName
public String getAlgorithmName()
- Overrides:
getAlgorithmName
in classKeyDerivationFunctionParameters
- Returns:
- the algorithm name (hint) of the Key Derivation Function that use these parameters.
-
getCostParameter
public int getCostParameter()
- Returns:
- the CPU/Memory cost parameter N.
-
getParallelizationParameter
public int getParallelizationParameter()
- Returns:
- the parallelization parameter.
-
getSalt
public byte[] getSalt()
- Returns:
- the salt value.
-
getBlockSize
public int getBlockSize()
- Returns:
- the block size parameter r.
-
-