Class ScryptParameters


  • public class ScryptParameters
    extends KeyDerivationFunctionParameters
    Key derivation function parameters for Scrypt functions.
    Since:
    5.4M1
    Version:
    $Id: f332481ea566da301559c953d9bf38ef727517ad $
    • Constructor Detail

      • ScryptParameters

        public ScryptParameters()
        Initialize all parameters to default values, using a random salt, a cost parameter of 1024, a parallelization parameter of 1 and a block size of 8.
      • 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) / 1024
        salt - 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

      • 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.