Package de.mkammerer.argon2
Class Argon2Helper
- java.lang.Object
-
- de.mkammerer.argon2.Argon2Helper
-
public final class Argon2Helper extends java.lang.Object
Provides useful helper methods to work with Argon2.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static interface
Argon2Helper.IterationLogger
Logger for the iteration tests.static class
Argon2Helper.NoopLogger
Logs nothing.
-
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.
-
-
-
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. SeeArgon2.hash(int, int, int, char[])
.parallelism
- Parallelism. SeeArgon2.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. SeeArgon2.hash(int, int, int, char[])
.parallelism
- Parallelism. SeeArgon2.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.
-
-