Class Argon2BytesGenerator
java.lang.Object
org.bouncycastle.crypto.generators.Argon2BytesGenerator
Argon2 PBKDF - Based on the results of https://password-hashing.net/ and https://www.ietf.org/archive/id/draft-irtf-cfrg-argon2-03.txt
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classA single 1024-byte memory block used by the Argon2 mixing function.static interfaceStrategy for allocating and recycling Argon2Argon2BytesGenerator.Blockobjects.static classBounded pool that recycles up tomaxBlocksArgon2BytesGenerator.Blockobjects. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionintgenerateBytes(byte[] password, byte[] out) intgenerateBytes(byte[] password, byte[] out, int outOff, int outLen) intgenerateBytes(char[] password, byte[] out) intgenerateBytes(char[] password, byte[] out, int outOff, int outLen) static intgetBlockCount(int memory, int lanes) Return the number ofArgon2BytesGenerator.Blocks a generator takes from itsArgon2BytesGenerator.BlockPoolfor the given memory size and degree of parallelism: the primary memory, after the alignment Argon2 applies to it, plus the blocks the fill step works in.voidinit(Argon2Parameters parameters) Initialise the Argon2BytesGenerator from the parameters.
-
Constructor Details
-
Argon2BytesGenerator
public Argon2BytesGenerator()
-
-
Method Details
-
init
Initialise the Argon2BytesGenerator from the parameters.- Parameters:
parameters- Argon2 configuration.
-
getBlockCount
public static int getBlockCount(int memory, int lanes) Return the number ofArgon2BytesGenerator.Blocks a generator takes from itsArgon2BytesGenerator.BlockPoolfor the given memory size and degree of parallelism: the primary memory, after the alignment Argon2 applies to it, plus the blocks the fill step works in. This is the size to give aArgon2BytesGenerator.FixedBlockPoolthat is to recycle every block of a run - the alignment rules are an implementation detail and are not to be replicated by callers.- Parameters:
memory- the memory size in 1K blocks, as passed toArgon2Parameters.Builder.withMemoryAsKB(int).lanes- the degree of parallelism, as passed toArgon2Parameters.Builder.withParallelism(int).- Returns:
- the number of blocks a generator has outstanding at once.
-
generateBytes
public int generateBytes(char[] password, byte[] out) -
generateBytes
public int generateBytes(char[] password, byte[] out, int outOff, int outLen) -
generateBytes
public int generateBytes(byte[] password, byte[] out) -
generateBytes
public int generateBytes(byte[] password, byte[] out, int outOff, int outLen)
-