|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectjava.util.Random
org.logi.crypto.random.PureSpinner
This class uses the scheduler to gather entropy.
To generate one byte of data it launches a thread which counts in a tight loop. After a certain time, this thread is killed and the 8 lowest order bytes of the counter are returned.
The spin-period is set when a PureSpinner object is created. It is chosen so that the counter will reach at least 1024 when a byte is generated. However, under excessive load the counter may not count much above 256.
The output of this RNG is may not have very good statistical properties, but each byte of data should contain one or two bits of entropy. It should not be used directly, but rather to gather entropy for another PRNG class such as the RandomSpinner class.
The helper class which does the actual number generation is based on code by Henry Strickland (strix@versant.com) and Greg Noel (greg@qualcomm.com). This was in turn based on similar C code by Matt Blaze, Jack Lacy, and Don Mitchell.
RandomMD5
,
Spinner
,
Serialized FormConstructor Summary | |
PureSpinner()
|
Method Summary | |
protected int |
next(int bits)
Generates the next random number. |
void |
nextBytes(byte[] bytes)
Generates a user specified number of random bytes. |
Methods inherited from class java.util.Random |
nextBoolean, nextDouble, nextFloat, nextGaussian, nextInt, nextInt, nextLong, setSeed |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
public PureSpinner()
Method Detail |
public void nextBytes(byte[] bytes)
protected int next(int bits)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |