Package jadex.commons.security.random
Class ChaCha20Random
- java.lang.Object
- 
- java.util.Random
- 
- java.security.SecureRandom
- 
- jadex.commons.security.random.ChaCha20Random
 
 
 
- 
- All Implemented Interfaces:
- java.io.Serializable
 
 public class ChaCha20Random extends java.security.SecureRandom- See Also:
- Serialized Form
 
- 
- 
Field SummaryFields Modifier and Type Field Description protected int[]basestateChaCha base stateprotected longblockcountCurrent block count.protected IEntropySourceentropysourceEntropy source for seeding, use SSecurity.protected intoutptrPointer to unused output.protected byte[]outputblockThe output block.
 - 
Constructor SummaryConstructors Constructor Description ChaCha20Random()Initializes the PRNG.ChaCha20Random(byte[] initialseed)Initializes the PRNG.ChaCha20Random(IEntropySource seedrandom)Initializes the PRNG.ChaCha20Random(IEntropySource entropysource, byte[] initialseed)Initializes the PRNG.
 - 
Method SummaryAll Methods Instance Methods Concrete Methods Modifier and Type Method Description byte[]generateSeed(int numbytes)Generates a seed value from OS source.protected voidnextBlock()Generates the next ChaCha block.voidnextBlock(byte[] outputblock)Generate next block (64 bytes).voidnextBytes(byte[] bytes)Gets the next bytes.intnextInt()Gets the next int.longnextLong()Gets the next long.voidreseed()Reseeds the PRNG.voidreseed(byte[] providedseed)Reseeds the PRNG.- 
Methods inherited from class java.security.SecureRandomgetAlgorithm, getInstance, getInstance, getInstance, getInstance, getInstance, getInstance, getInstanceStrong, getParameters, getProvider, getSeed, next, nextBytes, reseed, setSeed, setSeed, toString
 
- 
 
- 
- 
- 
Field Detail- 
entropysourceprotected IEntropySource entropysource Entropy source for seeding, use SSecurity.
 - 
basestateprotected int[] basestate ChaCha base state
 - 
blockcountprotected long blockcount Current block count.
 - 
outputblockprotected byte[] outputblock The output block.
 - 
outptrprotected int outptr Pointer to unused output.
 
- 
 - 
Constructor Detail- 
ChaCha20Randompublic ChaCha20Random() Initializes the PRNG.
 - 
ChaCha20Randompublic ChaCha20Random(IEntropySource seedrandom) Initializes the PRNG.
 - 
ChaCha20Randompublic ChaCha20Random(byte[] initialseed) Initializes the PRNG.
 - 
ChaCha20Randompublic ChaCha20Random(IEntropySource entropysource, byte[] initialseed) Initializes the PRNG.
 
- 
 - 
Method Detail- 
nextLongpublic long nextLong() Gets the next long.- Overrides:
- nextLongin class- java.util.Random
 
 - 
nextIntpublic int nextInt() Gets the next int.- Overrides:
- nextIntin class- java.util.Random
 
 - 
nextBytespublic void nextBytes(byte[] bytes) Gets the next bytes.- Overrides:
- nextBytesin class- java.security.SecureRandom
 
 - 
nextBlockprotected void nextBlock() Generates the next ChaCha block.
 - 
reseedpublic void reseed() Reseeds the PRNG.- Overrides:
- reseedin class- java.security.SecureRandom
 
 - 
reseedpublic void reseed(byte[] providedseed) Reseeds the PRNG.
 - 
nextBlockpublic void nextBlock(byte[] outputblock) Generate next block (64 bytes).- Parameters:
- outputblock- The block.
 
 - 
generateSeedpublic byte[] generateSeed(int numbytes) Generates a seed value from OS source.- Overrides:
- generateSeedin class- java.security.SecureRandom
 
 
- 
 
-