|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectjava.util.Random
ccs.chaos.SemiSecureRandom
public class SemiSecureRandom
A PRNG designed primarily for producing the long random bytestrings required
for overwriting sensitive data. It uses the statistically strong, fast, but
predictable conventional PRNG, and reseeds it frequently using the default
ChaosMage. This provides a good tradeoff between security and performance
(the default ChaosMage is too slow to use directly). NB. Only
nextBytes
is automatically reseeded in this way; the other
distributions and utility methods provided by the class are not. If you
need these you'll have to reseed manually. This class is not designed for
such use. MT-Safe.
Constructor Summary | |
---|---|
SemiSecureRandom()
|
Method Summary | |
---|---|
int |
getInterval()
Get the number of bytes produced between reseeds. |
void |
nextBytes(byte[] bytes)
Obtain random bytes. |
void |
reseed()
Reseed the predictable (fast) generator from the unpredictable (slow) one. |
void |
setInterval(int interval)
Sets the number of bytes produced between reseeds. |
Methods inherited from class java.util.Random |
---|
next, 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 SemiSecureRandom()
Method Detail |
---|
public void setInterval(int interval)
interval
- The numberpublic int getInterval()
public void reseed()
public void nextBytes(byte[] bytes)
nextBytes
in class java.util.Random
bytes
- The byte array to fill with random numbers. NB. the whole
array will be taken from the fast generator, with no reseeds in mid-array
even if the array is longer than the interval.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |