public class FortunaStandalone extends BasePRNGStandalone implements Serializable
There are some things users of this class must be aware of:
Serializable in such a way that it
writes a 64 byte seed to the stream, and reads it back again when being
deserialized. This is the extent of seed file management, however, and
those using this class are encouraged to think deeply about when, how
often, and where to store the seed.References:
| Modifier and Type | Field and Description |
|---|---|
protected IRandomStandalone | generatorthe underlying PRNG generator |
protected long | lastReseedtimestamp of last reseed |
(package private) static int | MIN_POOL_SIZEminimum bytes in pool 0 before reseed |
(package private) static int | NUM_POOLSnumber of entropy pools |
protected int | pool0Countbytes added to pool 0 |
protected MessageDigest[] | poolsnull if using DevRandom |
protected int | reseedCountnumber of reseeds performed |
static String | SEEDproperty name for the seed attribute |
buffer, initialised, name, ndx| Constructor and Description |
|---|
FortunaStandalone()With DevRandom disabled. |
FortunaStandalone(boolean useDevRandom) |
| Modifier and Type | Method and Description |
|---|---|
void | addRandomByte(byte b)Add a random byte to the entropy pool. |
void | addRandomBytes(byte[] buf,
int offset,
int length)Add random bytes to the entropy pool. |
Object | clone()Return a copy of this object. |
void | fillBlock()Unused, see AsyncFortunaStandalone |
void | seed(byte[] val)Unused, see AsyncFortunaStandalone. |
void | setup(Map<String,byte[]> attributes)Set up the PRNG instance. |
addRandomBytes, init, isInitialised, name, nextByte, nextBytes, nextBytesprotected final IRandomStandalone generator
protected long lastReseed
static final int MIN_POOL_SIZE
static final int NUM_POOLS
protected int pool0Count
protected final MessageDigest[] pools
protected int reseedCount
public static final String SEED
public FortunaStandalone()
public FortunaStandalone(boolean useDevRandom)
useDevRandom - if true, use DevRandom instead of the Fortuna Generatorpublic void addRandomByte(byte b)
addRandomByte in interface IRandomStandaloneaddRandomByte in class BasePRNGStandaloneb - The byte to add.public void addRandomBytes(byte[] buf,
int offset,
int length)addRandomBytes in interface IRandomStandaloneaddRandomBytes in class BasePRNGStandalonebuf - The buffer of new random bytes to add.offset - The offset from whence to begin reading random bytes.length - The number of random bytes to add.public Object clone()
clone in interface IRandomStandaloneclone in class BasePRNGStandalonepublic void fillBlock()
fillBlock in class BasePRNGStandalonepublic void seed(byte[] val)
public void setup(Map<String,byte[]> attributes)
setup in class BasePRNGStandaloneattributes - the attributes for setup