public class RandomSource extends SecureRandom implements EntropyHarvester
| Modifier and Type | Field and Description |
|---|---|
protected I2PAppContext | _context_context. |
| Constructor and Description |
|---|
RandomSource(I2PAppContext context)Deprecated - do not instantiate this directly, as you won't get the
good one (Fortuna). |
| Modifier and Type | Method and Description |
|---|---|
void | feedEntropy(String source,
byte[] data,
int offset,
int len)feedEntropy. |
void | feedEntropy(String source,
long data,
int bitoffset,
int bits)feedEntropy. |
static RandomSource | getInstance()Singleton for whatever PRNG i2p uses. |
EntropyHarvester | harvester()harvester. |
boolean | initSeed(byte[] buf)May block up to 10 seconds |
void | loadSeed()May block up to 10 seconds |
void | nextBytes(byte[] buf,
int offset,
int length)Not part of java.util.SecureRandom, but added since Fortuna supports it. |
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(long n)Like the modified nextInt, nextLong(n) returns a random number from 0 through n,
including 0, excluding n. |
void | saveSeed()saveSeed. |
int | signedNextInt()This code unused, see FortunaRandomSource override |
static void | writeSeed(byte[] buf)writeSeed. |
generateSeed, getAlgorithm, getInstance, getInstance, getInstance, getInstanceStrong, getProvider, getSeed, next, nextBytes, setSeed, setSeedprotected final transient I2PAppContext _context
public RandomSource(I2PAppContext context)
public void feedEntropy(String source, byte[] data, int offset, int len)
feedEntropy in interface EntropyHarvestersource - 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 EntropyHarvestersource - 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 static RandomSource getInstance()
public EntropyHarvester harvester()
public final boolean initSeed(byte[] buf)
public void loadSeed()
public void nextBytes(byte[] buf,
int offset,
int length)public int nextInt(int n)
public long nextLong(long n)
public void saveSeed()
public int signedNextInt()
public static final void writeSeed(byte[] buf)