org.bouncycastle.crypto.prng

Class DigestRandomGenerator

Implemented Interfaces:
RandomGenerator

public class DigestRandomGenerator
extends java.lang.Object
implements RandomGenerator

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

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

Constructor Summary

DigestRandomGenerator(Digest digest)

Method Summary

void
addSeedMaterial(byte[] inSeed)
void
addSeedMaterial(long rSeed)
void
nextBytes(byte[] bytes)
void
nextBytes(byte[] bytes, int start, int len)

Constructor Details

DigestRandomGenerator

public DigestRandomGenerator(Digest digest)

Method Details

addSeedMaterial

public void addSeedMaterial(byte[] inSeed)
Specified by:
addSeedMaterial in interface RandomGenerator

addSeedMaterial

public void addSeedMaterial(long rSeed)
Specified by:
addSeedMaterial in interface RandomGenerator

nextBytes

public void nextBytes(byte[] bytes)
Specified by:
nextBytes in interface RandomGenerator

nextBytes

public void nextBytes(byte[] bytes,
                      int start,
                      int len)
Specified by:
nextBytes in interface RandomGenerator