Package org.bouncycastle.crypto.prng
Class ReversedWindowGenerator
- java.lang.Object
-
- org.bouncycastle.crypto.prng.ReversedWindowGenerator
-
- All Implemented Interfaces:
RandomGenerator
public class ReversedWindowGenerator extends java.lang.Object implements RandomGenerator
Takes bytes generated by an underling RandomGenerator and reverses the order in each small window (of configurable size).Access to internals is synchronized so a single one of these can be shared.
-
-
Constructor Summary
Constructors Constructor Description ReversedWindowGenerator(RandomGenerator generator, int windowSize)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addSeedMaterial(byte[] seed)
Add more seed material to the generator.void
addSeedMaterial(long seed)
Add more seed material to the generator.void
nextBytes(byte[] bytes)
Fill bytes with random values.void
nextBytes(byte[] bytes, int start, int len)
Fill part of bytes with random values.
-
-
-
Constructor Detail
-
ReversedWindowGenerator
public ReversedWindowGenerator(RandomGenerator generator, int windowSize)
-
-
Method Detail
-
addSeedMaterial
public void addSeedMaterial(byte[] seed)
Add more seed material to the generator.- Specified by:
addSeedMaterial
in interfaceRandomGenerator
- Parameters:
seed
- a byte array to be mixed into the generator's state.
-
addSeedMaterial
public void addSeedMaterial(long seed)
Add more seed material to the generator.- Specified by:
addSeedMaterial
in interfaceRandomGenerator
- Parameters:
seed
- a long value to be mixed into the generator's state.
-
nextBytes
public void nextBytes(byte[] bytes)
Fill bytes with random values.- Specified by:
nextBytes
in interfaceRandomGenerator
- Parameters:
bytes
- byte array to be filled.
-
nextBytes
public void nextBytes(byte[] bytes, int start, int len)
Fill part of bytes with random values.- Specified by:
nextBytes
in interfaceRandomGenerator
- Parameters:
bytes
- byte array to be filled.start
- index to start filling at.len
- length of segment to fill.
-
-