public class FortunaStandalone extends BasePRNGStandalone implements Serializable, RandomEventListenerStandalone
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 | Class and Description |
---|---|
static class |
FortunaStandalone.Generator
The Fortuna generator function.
|
Modifier and Type | Field and Description |
---|---|
(package private) FortunaStandalone.Generator |
generator |
(package private) static long |
lastRefill |
(package private) long |
lastReseed |
(package private) static int |
MIN_POOL_SIZE |
(package private) static int |
NUM_POOLS |
(package private) int |
pool |
(package private) int |
pool0Count |
(package private) MessageDigest[] |
pools |
(package private) static long |
refillCount |
(package private) int |
reseedCount |
static String |
SEED |
buffer, initialised, name, ndx
Constructor and Description |
---|
FortunaStandalone() |
Modifier and Type | Method and Description |
---|---|
void |
addRandomByte(byte b)
Supplement, or possibly replace, the random state of this PRNG with
a random byte.
|
void |
addRandomBytes(byte[] buf,
int offset,
int length)
Supplement, or possibly replace, the random state of this PRNG with
a sequence of new random bytes.
|
void |
addRandomEvent(RandomEventStandalone event) |
protected void |
allocBuffer() |
void |
fillBlock() |
void |
seed(byte[] val) |
void |
setup(Map<String,byte[]> attributes) |
addRandomBytes, clone, init, isInitialised, name, nextByte, nextBytes, nextBytes
static final int NUM_POOLS
static final int MIN_POOL_SIZE
final FortunaStandalone.Generator generator
final MessageDigest[] pools
long lastReseed
int pool
int pool0Count
int reseedCount
static long refillCount
static long lastRefill
public static final String SEED
protected void allocBuffer()
public void seed(byte[] val)
public void setup(Map<String,byte[]> attributes)
setup
in class BasePRNGStandalone
public void fillBlock()
fillBlock
in class BasePRNGStandalone
public void addRandomByte(byte b)
IRandomStandalone
Supplement, or possibly replace, the random state of this PRNG with a random byte.
Implementations are not required to implement this method in any
meaningful way; this may be a no-operation, and implementations may
throw an UnsupportedOperationException
.
addRandomByte
in interface IRandomStandalone
addRandomByte
in class BasePRNGStandalone
b
- The byte to add.public void addRandomBytes(byte[] buf, int offset, int length)
IRandomStandalone
Supplement, or possibly replace, the random state of this PRNG with a sequence of new random bytes.
Implementations are not required to implement this method in any
meaningful way; this may be a no-operation, and implementations may
throw an UnsupportedOperationException
.
addRandomBytes
in interface IRandomStandalone
addRandomBytes
in class BasePRNGStandalone
buf
- 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 void addRandomEvent(RandomEventStandalone event)
addRandomEvent
in interface RandomEventListenerStandalone