Class Argon2Helper


  • public final class Argon2Helper
    extends java.lang.Object
    Provides useful helper methods to work with Argon2.
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static int findIterations​(Argon2 argon2, long maxMillisecs, int memory, int parallelism)
      Finds the number of iterations so that the hash function takes at most the given number of milliseconds.
      static int findIterations​(Argon2 argon2, long maxMillisecs, int memory, int parallelism, Argon2Helper.IterationLogger logger)
      Finds the number of iterations so that the hash function takes at most the given number of milliseconds.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Method Detail

      • findIterations

        public static int findIterations​(Argon2 argon2,
                                         long maxMillisecs,
                                         int memory,
                                         int parallelism)
        Finds the number of iterations so that the hash function takes at most the given number of milliseconds.
        Parameters:
        argon2 - Argon2 instance.
        maxMillisecs - Maximum number of milliseconds the hash function must take.
        memory - Memory. See Argon2.hash(int, int, int, char[]).
        parallelism - Parallelism. See Argon2.hash(int, int, int, char[]).
        Returns:
        The number of iterations so that the hash function takes at most the given number of milliseconds.
      • findIterations

        public static int findIterations​(Argon2 argon2,
                                         long maxMillisecs,
                                         int memory,
                                         int parallelism,
                                         Argon2Helper.IterationLogger logger)
        Finds the number of iterations so that the hash function takes at most the given number of milliseconds.
        Parameters:
        argon2 - Argon2 instance.
        maxMillisecs - Maximum number of milliseconds the hash function must take.
        memory - Memory. See Argon2.hash(int, int, int, char[]).
        parallelism - Parallelism. See Argon2.hash(int, int, int, char[]).
        logger - Logger which gets called with the runtime of the tested iteration steps.
        Returns:
        The number of iterations so that the hash function takes at most the given number of milliseconds.