Class Argon2Parameters.Builder

    • Method Detail

      • withParallelism

        public Argon2Parameters.Builder withParallelism​(int parallelism)
        Set the parallelism (number of lanes).
        Parameters:
        parallelism - the degree of parallelism, must be at least 1.
        Returns:
        this builder.
      • withSalt

        public Argon2Parameters.Builder withSalt​(byte[] salt)
        Set the salt. The supplied array is defensively cloned.
        Parameters:
        salt - salt bytes; may be null.
        Returns:
        this builder.
      • withSecret

        public Argon2Parameters.Builder withSecret​(byte[] secret)
        Set the optional secret (key) value. The supplied array is defensively cloned.
        Parameters:
        secret - secret bytes; may be null.
        Returns:
        this builder.
      • withAdditional

        public Argon2Parameters.Builder withAdditional​(byte[] additional)
        Set the optional additional/associated data. The supplied array is defensively cloned.
        Parameters:
        additional - additional data bytes; may be null.
        Returns:
        this builder.
      • withIterations

        public Argon2Parameters.Builder withIterations​(int iterations)
        Set the number of passes (time cost).
        Parameters:
        iterations - number of iterations, must be at least 1.
        Returns:
        this builder.
      • withMemoryAsKB

        public Argon2Parameters.Builder withMemoryAsKB​(int memory)
        Set the memory cost expressed directly in KiB.
        Parameters:
        memory - memory in KiB; must be in [1, 1 << MAX_MEMORY_EXP].
        Returns:
        this builder.
        Throws:
        java.lang.IllegalArgumentException - if the value is out of range.
      • withMemoryPowOfTwo

        public Argon2Parameters.Builder withMemoryPowOfTwo​(int memory)
        Set the memory cost as a power of two: the resulting memory in KiB is 1 << memory.
        Parameters:
        memory - exponent; must be in [0, MAX_MEMORY_EXP].
        Returns:
        this builder.
        Throws:
        java.lang.IllegalArgumentException - if the exponent is out of range.
      • clear

        public void clear()
        Zeroise sensitive state (salt, secret, additional) held by this builder.