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 |
generator |
protected long |
lastReseed |
(package private) static int |
MIN_POOL_SIZE |
(package private) static int |
NUM_POOLS |
protected int |
pool0Count |
protected MessageDigest[] |
pools |
protected int |
reseedCount |
static String |
SEED |
buffer, initialised, name, ndx
Constructor and Description |
---|
FortunaStandalone() |
FortunaStandalone(boolean useDevRandom) |
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.
|
protected void |
allocBuffer()
Unused, see AsyncFortunaStandalone
|
void |
fillBlock()
Unused, see AsyncFortunaStandalone
|
void |
seed(byte[] val)
Unused, see AsyncFortunaStandalone
|
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
protected final IRandomStandalone generator
protected final MessageDigest[] pools
protected long lastReseed
protected int pool0Count
protected int reseedCount
public static final String SEED
public FortunaStandalone()
public FortunaStandalone(boolean useDevRandom)
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.