java.lang.Object
io.getlime.security.powerauth.crypto.lib.model.Argon2Hash

public class Argon2Hash extends Object
Class representing Argon2 hash in Modular Crypt Format.
Author:
Roman Strobl, roman.strobl@wultra.com
  • Constructor Details

    • Argon2Hash

      public Argon2Hash(String algorithm)
      Constructor with algorithm name.
      Parameters:
      algorithm - Algorithm name.
  • Method Details

    • parse

      public static Argon2Hash parse(String input) throws IOException
      Construct Argon2 parameters from definition in Modular Crypt Format.
      Parameters:
      input - Definition in Modular Crypt Format.
      Returns:
      Argon2 hash instance.
      Throws:
      IOException - In case parsing of hash fails.
    • getAlgorithm

      public String getAlgorithm()
      Get algorithm name.
      Returns:
      Algorithm name.
    • setAlgorithm

      public void setAlgorithm(String algorithm)
      Set algorithm name.
      Parameters:
      algorithm - Algorithm name.
    • getVersion

      public Integer getVersion()
      Get algorithm version.
      Returns:
      Algorithm version.
    • setVersion

      public void setVersion(Integer version)
      Set algorithm version.
      Parameters:
      version - Algorithm version.
    • getParameters

      public Map<String,Integer> getParameters()
      Get algorithm parameters.
      Returns:
      Algorithm parameters.
    • setParameters

      public void setParameters(Map<String,Integer> parameters)
      Set algorithm parameters.
      Parameters:
      parameters - Algorithm parameters.
    • getIterations

      public Integer getIterations()
      Get iteration count.
      Returns:
      Iteration count.
    • setIterations

      public void setIterations(Integer iterations)
      Set iteration count.
      Parameters:
      iterations - Iteration count.
    • getMemory

      public Integer getMemory()
      Get memory in bytes.
      Returns:
      Memory in bytes.
    • setMemory

      public void setMemory(Integer memory)
      Set memory in bytes.
      Parameters:
      memory - Memory in bytes.
    • getParallelism

      public Integer getParallelism()
      Get parallelism parameter.
      Returns:
      Parallelism parameter.
    • setParallelism

      public void setParallelism(Integer parallelism)
      Set parallelism parameter.
      Parameters:
      parallelism - Parallelism parameter.
    • getSalt

      public byte[] getSalt()
      Get salt bytes.
      Returns:
      Salt bytes.
    • setSalt

      public void setSalt(byte[] salt)
      Set salt bytes.
      Parameters:
      salt - Salt bytes.
    • getDigest

      public byte[] getDigest()
      Get digest bytes.
      Returns:
      Digest bytes.
    • setDigest

      public void setDigest(byte[] digest)
      Set digest bytes.
      Parameters:
      digest - Digest bytes.
    • hashEquals

      public boolean hashEquals(Argon2Hash other)
      Compare Argon2 hashes.
      Parameters:
      other - Other Argon2 hash.
      Returns:
      True if hashes are identical.
    • toString

      public String toString()
      Convert Argon2 hash to String in Modular Crypt Format.
      Overrides:
      toString in class Object
      Returns:
      Argon2 hash in Modular Crypt Format