|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectgnu.crypto.prng.BasePRNGStandalone
gnu.crypto.prng.FortunaStandalone
public class FortunaStandalone
The Fortuna continuously-seeded pseudo-random number generator. This generator is composed of two major pieces: the entropy accumulator and the generator function. The former takes in random bits and incorporates them into the generator's state. The latter takes this base entropy and generates pseudo-random bits from it.
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:
Nested Class Summary | |
---|---|
static class |
FortunaStandalone.Generator
The Fortuna generator function. |
Field Summary | |
---|---|
(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
|
Fields inherited from class gnu.crypto.prng.BasePRNGStandalone |
---|
buffer, initialised, name, ndx |
Constructor Summary | |
---|---|
FortunaStandalone()
|
Method Summary | |
---|---|
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 attributes)
|
Methods inherited from class gnu.crypto.prng.BasePRNGStandalone |
---|
addRandomBytes, clone, init, isInitialised, name, nextByte, nextBytes, nextBytes |
Methods inherited from class java.lang.Object |
---|
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
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
Constructor Detail |
---|
public FortunaStandalone()
Method Detail |
---|
protected void allocBuffer()
public void seed(byte[] val)
public void setup(Map 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
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |