|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectjava.util.Random
java.security.SecureRandom
net.i2p.util.RandomSource
net.i2p.util.FortunaRandomSource
public class FortunaRandomSource
Wrapper around GNU-Crypto's Fortuna PRNG. This seeds from /dev/urandom and ./prngseed.rnd on startup (if they exist), writing a new seed to ./prngseed.rnd on an explicit call to saveSeed().
Field Summary |
---|
Fields inherited from class net.i2p.util.RandomSource |
---|
_context |
Constructor Summary | |
---|---|
FortunaRandomSource(I2PAppContext context)
|
Method Summary | |
---|---|
void |
feedEntropy(java.lang.String source,
byte[] data,
int offset,
int len)
reseed the fortuna |
void |
feedEntropy(java.lang.String source,
long data,
int bitoffset,
int bits)
reseed the fortuna |
EntropyHarvester |
harvester()
|
static void |
main(java.lang.String[] args)
|
protected int |
nextBits(int numBits)
Pull the next numBits of random data off the fortuna instance (returning -2^numBits-1 through 2^numBits-1 |
boolean |
nextBoolean()
override as synchronized, for those JVMs that don't always pull via nextBytes (cough ibm) |
void |
nextBytes(byte[] buf)
override as synchronized, for those JVMs that don't always pull via nextBytes (cough ibm) |
double |
nextDouble()
Implementation from sun's java.util.Random javadocs |
float |
nextFloat()
Implementation from sun's java.util.Random javadocs |
double |
nextGaussian()
Implementation from sun's java.util.Random javadocs |
int |
nextInt()
override as synchronized, for those JVMs that don't always pull via nextBytes (cough ibm) |
int |
nextInt(int n)
According to the java docs (http://java.sun.com/j2se/1.4.1/docs/api/java/util/Random.html#nextInt(int)) nextInt(n) should return a number between 0 and n (including 0 and excluding n). |
long |
nextLong()
override as synchronized, for those JVMs that don't always pull via nextBytes (cough ibm) |
long |
nextLong(long n)
Like the modified nextInt, nextLong(n) returns a random number from 0 through n, including 0, excluding n. |
void |
setSeed(byte[] buf)
|
Methods inherited from class net.i2p.util.RandomSource |
---|
getInstance, initSeed, loadSeed, saveSeed, writeSeed |
Methods inherited from class java.security.SecureRandom |
---|
generateSeed, getAlgorithm, getInstance, getInstance, getInstance, getProvider, getSeed, next, setSeed |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public FortunaRandomSource(I2PAppContext context)
Method Detail |
---|
public void setSeed(byte[] buf)
setSeed
in class java.security.SecureRandom
public int nextInt(int n)
nextInt
in class RandomSource
public int nextInt()
RandomSource
nextInt
in class RandomSource
public long nextLong(long n)
nextLong
in class RandomSource
public long nextLong()
RandomSource
nextLong
in class RandomSource
public boolean nextBoolean()
RandomSource
nextBoolean
in class RandomSource
public void nextBytes(byte[] buf)
RandomSource
nextBytes
in class RandomSource
public double nextDouble()
nextDouble
in class RandomSource
public float nextFloat()
nextFloat
in class RandomSource
public double nextGaussian()
nextGaussian
in class RandomSource
protected int nextBits(int numBits)
public EntropyHarvester harvester()
harvester
in class RandomSource
public void feedEntropy(java.lang.String source, long data, int bitoffset, int bits)
feedEntropy
in interface EntropyHarvester
feedEntropy
in class RandomSource
source
- origin of the entropy, allowing the harvester to
determine how much to value the databitoffset
- bit index into the data array to start
(using java standard big-endian)bits
- how many bits to usepublic void feedEntropy(java.lang.String source, byte[] data, int offset, int len)
feedEntropy
in interface EntropyHarvester
feedEntropy
in class RandomSource
source
- origin of the entropy, allowing the harvester to
determine how much to value the dataoffset
- index into the data array to startlen
- how many bytes to usepublic static void main(java.lang.String[] args)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |