Top Description Fields Constructors Methods
org.bouncycastle.crypto.prng

public Class DigestRandomGenerator

extends Object
implements RandomGenerator
Class Inheritance
All Implemented Interfaces
org.bouncycastle.crypto.prng.RandomGenerator
Imports
org.bouncycastle.crypto.Digest, org.bouncycastle.util.Arrays

Random generation based on the digest with counter. Calling addSeedMaterial will always increase the entropy of the hash.

Internal access to the digest is synchronized so a single one of these can be shared.

Field Summary

Modifier and TypeField and Description
private static long
private Digest
private byte[]
private long
private byte[]
private long

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public void
addSeedMaterial(byte[]
a byte array to be mixed into the generator's state.
inSeed
)

Implements org.bouncycastle.crypto.prng.RandomGenerator.addSeedMaterial.

Add more seed material to the generator.

public void
addSeedMaterial(long
a long value to be mixed into the generator's state.
rSeed
)

Implements org.bouncycastle.crypto.prng.RandomGenerator.addSeedMaterial.

Add more seed material to the generator.

private void
private void
digestAddCounter(long seed)

private void
digestDoFinal(byte[] result)

private void
digestUpdate(byte[] inSeed)

private void
public void
nextBytes(byte[]
byte array to be filled.
bytes
)

Implements org.bouncycastle.crypto.prng.RandomGenerator.nextBytes.

Fill bytes with random values.

public void
nextBytes(byte[]
byte array to be filled.
bytes
,
int
index to start filling at.
start
,
int
length of segment to fill.
len
)

Implements org.bouncycastle.crypto.prng.RandomGenerator.nextBytes.

Fill part of bytes with random values.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

CYCLE_COUNTback to summary
private static long CYCLE_COUNT
digestback to summary
private Digest digest
seedback to summary
private byte[] seed
seedCounterback to summary
private long seedCounter
stateback to summary
private byte[] state
stateCounterback to summary
private long stateCounter

Constructor Detail

DigestRandomGeneratorback to summary
public DigestRandomGenerator(Digest digest)

Method Detail

addSeedMaterialback to summary
public void addSeedMaterial(byte[] inSeed)

Implements org.bouncycastle.crypto.prng.RandomGenerator.addSeedMaterial.

Doc from org.bouncycastle.crypto.prng.RandomGenerator.addSeedMaterial.

Add more seed material to the generator.

Parameters
inSeed:byte[]

a byte array to be mixed into the generator's state.

addSeedMaterialback to summary
public void addSeedMaterial(long rSeed)

Implements org.bouncycastle.crypto.prng.RandomGenerator.addSeedMaterial.

Doc from org.bouncycastle.crypto.prng.RandomGenerator.addSeedMaterial.

Add more seed material to the generator.

Parameters
rSeed:long

a long value to be mixed into the generator's state.

cycleSeedback to summary
private void cycleSeed()
digestAddCounterback to summary
private void digestAddCounter(long seed)
digestDoFinalback to summary
private void digestDoFinal(byte[] result)
digestUpdateback to summary
private void digestUpdate(byte[] inSeed)
generateStateback to summary
private void generateState()
nextBytesback to summary
public void nextBytes(byte[] bytes)

Implements org.bouncycastle.crypto.prng.RandomGenerator.nextBytes.

Doc from org.bouncycastle.crypto.prng.RandomGenerator.nextBytes.

Fill bytes with random values.

Parameters
bytes:byte[]

byte array to be filled.

nextBytesback to summary
public void nextBytes(byte[] bytes, int start, int len)

Implements org.bouncycastle.crypto.prng.RandomGenerator.nextBytes.

Doc from org.bouncycastle.crypto.prng.RandomGenerator.nextBytes.

Fill part of bytes with random values.

Parameters
bytes:byte[]

byte array to be filled.

start:int

index to start filling at.

len:int

length of segment to fill.