public class FortunaRandomSource extends RandomSource implements EntropyHarvester
_context| Constructor and Description |
|---|
FortunaRandomSource(I2PAppContext context)May block up to 10 seconds or forever |
| Modifier and Type | Method and Description |
|---|---|
void | feedEntropy(String source,
byte[] data,
int offset,
int len)reseed the fortuna |
void | feedEntropy(String source,
long data,
int bitoffset,
int bits)reseed the fortuna |
protected int | nextBits(int numBits)Pull the next numBits of random data off the fortuna instance (returning 0
through 2^numBits-1
Caller must synchronize! |
boolean | nextBoolean()Random boolean. |
byte | nextByte()Not part of java.util.SecureRandom, but added for efficiency, since Fortuna supports it. |
void | nextBytes(byte[] buf)Fill buffer with random bytes. |
void | nextBytes(byte[] buf,
int offset,
int length)Not part of java.util.SecureRandom, but added for efficiency, since Fortuna supports it. |
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()Non-negative random int. |
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()All possible long values, positive and negative. |
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)Seed the Fortuna PRNG. |
void | shutdown()Note - methods may hang or NPE or throw IllegalStateExceptions after this |
int | signedNextInt()This code unused, see FortunaRandomSource override |
getInstance, harvester, initSeed, loadSeed, saveSeed, writeSeedgenerateSeed, getAlgorithm, getInstance, getInstance, getInstance, getInstanceStrong, getProvider, getSeed, next, setSeedpublic FortunaRandomSource(I2PAppContext context)
context - the contextpublic void feedEntropy(String source, byte[] data, int offset, int len)
feedEntropy in interface EntropyHarvesterfeedEntropy in class RandomSourcesource - 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 void feedEntropy(String source, long data, int bitoffset, int bits)
feedEntropy in interface EntropyHarvesterfeedEntropy in class RandomSourcesource - 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 useprotected int nextBits(int numBits)
public boolean nextBoolean()
nextBoolean in class Randompublic byte nextByte()
public void nextBytes(byte[] buf)
nextBytes in class SecureRandompublic void nextBytes(byte[] buf,
int offset,
int length)nextBytes in class RandomSourcepublic double nextDouble()
nextDouble in class Randompublic float nextFloat()
public double nextGaussian()
nextGaussian in class Randompublic int nextInt(int n)
nextInt in class RandomSourcen - non-negativeIllegalArgumentException - if n is negativepublic long nextLong()
public long nextLong(long n)
nextLong in class RandomSourcen - non-negativeIllegalArgumentException - if n is negativepublic void setSeed(byte[] buf)
setSeed in class SecureRandompublic void shutdown()
public int signedNextInt()
RandomSourcesignedNextInt in class RandomSource