public class ChaCha20Random
extends java.security.SecureRandom
Modifier and Type | Field and Description |
---|---|
protected int[] |
basestate
ChaCha base state
|
protected long |
blockcount
Current block count.
|
protected IEntropySource |
entropysource
Entropy source for seeding, use SSecurity.
|
protected int |
outptr
Pointer to unused output.
|
protected byte[] |
outputblock
The output block.
|
Constructor and 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.
|
Modifier and Type | Method and Description |
---|---|
byte[] |
generateSeed(int numbytes)
Generates a seed value from OS source.
|
protected void |
nextBlock()
Generates the next ChaCha block.
|
void |
nextBlock(byte[] outputblock)
Generate next block (64 bytes).
|
void |
nextBytes(byte[] bytes)
Gets the next bytes.
|
int |
nextInt()
Gets the next int.
|
long |
nextLong()
Gets the next long.
|
void |
reseed()
Reseeds the PRNG.
|
void |
reseed(byte[] providedseed)
Reseeds the PRNG.
|
getAlgorithm, getInstance, getInstance, getInstance, getInstanceStrong, getProvider, getSeed, next, setSeed, setSeed
protected IEntropySource entropysource
protected int[] basestate
protected long blockcount
protected byte[] outputblock
protected int outptr
public ChaCha20Random()
public ChaCha20Random(IEntropySource seedrandom)
public ChaCha20Random(byte[] initialseed)
public ChaCha20Random(IEntropySource entropysource, byte[] initialseed)
public long nextLong()
nextLong
in class java.util.Random
public int nextInt()
nextInt
in class java.util.Random
public void nextBytes(byte[] bytes)
nextBytes
in class java.security.SecureRandom
protected void nextBlock()
public void reseed()
public void reseed(byte[] providedseed)
public void nextBlock(byte[] outputblock)
outputblock
- The block.public byte[] generateSeed(int numbytes)
generateSeed
in class java.security.SecureRandom