|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.bouncycastle.crypto.prng.DigestRandomGenerator
public class DigestRandomGenerator
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 | |
---|---|
private long |
counter
|
private Digest |
digest
|
private byte[] |
state
|
Constructor Summary | |
---|---|
DigestRandomGenerator(Digest digest)
|
Method Summary | |
---|---|
void |
addSeedMaterial(byte[] inSeed)
Add more seed material to the generator. |
void |
addSeedMaterial(long rSeed)
Add more seed material to the generator. |
private void |
digestDoFinal(byte[] result)
|
private void |
digestUpdate(byte[] inSeed)
|
private void |
digestUpdate(long seed)
|
void |
nextBytes(byte[] bytes)
Fill bytes with random values. |
void |
nextBytes(byte[] bytes,
int start,
int len)
Fill part of bytes with random values. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
private long counter
private Digest digest
private byte[] state
Constructor Detail |
---|
public DigestRandomGenerator(Digest digest)
Method Detail |
---|
public void addSeedMaterial(byte[] inSeed)
RandomGenerator
addSeedMaterial
in interface RandomGenerator
inSeed
- a byte array to be mixed into the generator's state.public void addSeedMaterial(long rSeed)
RandomGenerator
addSeedMaterial
in interface RandomGenerator
rSeed
- a long value to be mixed into the generator's state.public void nextBytes(byte[] bytes)
RandomGenerator
nextBytes
in interface RandomGenerator
bytes
- byte array to be filled.public void nextBytes(byte[] bytes, int start, int len)
RandomGenerator
nextBytes
in interface RandomGenerator
bytes
- byte array to be filled.start
- index to start filling at.len
- length of segment to fill.private void digestUpdate(long seed)
private void digestUpdate(byte[] inSeed)
private void digestDoFinal(byte[] result)
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |