|
|||||||||
Home >> All >> gnu >> javax >> crypto >> [ prng overview ] | PREV CLASS NEXT CLASS | ||||||||
SUMMARY: ![]() ![]() ![]() |
DETAIL: FIELD | CONSTR | METHOD |
gnu.javax.crypto.prng
Class Fortuna.Generator

java.lang.Objectgnu.java.security.prng.BasePRNG
gnu.javax.crypto.prng.Fortuna.Generator
- All Implemented Interfaces:
- java.lang.Cloneable, gnu.java.security.prng.IRandom
- Enclosing class:
- Fortuna
- public static class Fortuna.Generator
- extends gnu.java.security.prng.BasePRNG
- implements java.lang.Cloneable
- extends gnu.java.security.prng.BasePRNG
The Fortuna generator function. The generator is a PRNG in its own right; Fortuna itself is basically a wrapper around this generator that manages reseeding in a secure way.
Field Summary | |
private gnu.javax.crypto.cipher.IBlockCipher |
cipher
|
private byte[] |
counter
|
private gnu.java.security.hash.IMessageDigest |
hash
|
private byte[] |
key
|
private static int |
LIMIT
|
private boolean |
seeded
|
Fields inherited from class gnu.java.security.prng.BasePRNG |
buffer, initialised, name, ndx |
Constructor Summary | |
Fortuna.Generator(gnu.javax.crypto.cipher.IBlockCipher cipher,
gnu.java.security.hash.IMessageDigest hash)
|
Method Summary | |
void |
addRandomByte(byte b)
Supplement, or possibly replace, the random state of this PRNG with a random byte. |
void |
addRandomBytes(byte[] seed,
int offset,
int length)
Supplement, or possibly replace, the random state of this PRNG with a sequence of new random bytes. |
void |
fillBlock()
|
private void |
incrementCounter()
Increment `counter' as a sixteen-byte little-endian unsigned integer by one. |
byte |
nextByte()
Returns the next 8 bits of random data generated from this instance. |
void |
nextBytes(byte[] out,
int offset,
int length)
Fills the designated byte array, starting from byte at index offset , for a maximum of length bytes with the
output of this generator instance. |
private void |
resetKey()
Resets the cipher's key. |
void |
setup(java.util.Map attributes)
|
Methods inherited from class gnu.java.security.prng.BasePRNG |
addRandomBytes, clone, init, isInitialised, name, nextBytes |
Methods inherited from class java.lang.Object |
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
LIMIT
private static final int LIMIT
- See Also:
- Constant Field Values
cipher
private final gnu.javax.crypto.cipher.IBlockCipher cipher
hash
private final gnu.java.security.hash.IMessageDigest hash
counter
private final byte[] counter
key
private final byte[] key
seeded
private boolean seeded
Constructor Detail |
Fortuna.Generator
public Fortuna.Generator(gnu.javax.crypto.cipher.IBlockCipher cipher, gnu.java.security.hash.IMessageDigest hash)
Method Detail |
nextByte
public byte nextByte()
- Description copied from interface:
gnu.java.security.prng.IRandom
Returns the next 8 bits of random data generated from this instance.
- Specified by:
nextByte
in interfacegnu.java.security.prng.IRandom
nextBytes
public void nextBytes(byte[] out, int offset, int length)
- Description copied from interface:
gnu.java.security.prng.IRandom
Fills the designated byte array, starting from byte at index
offset
, for a maximum oflength
bytes with the output of this generator instance.- Specified by:
nextBytes
in interfacegnu.java.security.prng.IRandom
addRandomByte
public void addRandomByte(byte b)
- Description copied from interface:
gnu.java.security.prng.IRandom
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 java.lang.UnsupportedOperationException.
- Specified by:
addRandomByte
in interfacegnu.java.security.prng.IRandom
addRandomBytes
public void addRandomBytes(byte[] seed, int offset, int length)
- Description copied from interface:
gnu.java.security.prng.IRandom
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 java.lang.UnsupportedOperationException.
- Specified by:
addRandomBytes
in interfacegnu.java.security.prng.IRandom
fillBlock
public void fillBlock()
setup
public void setup(java.util.Map attributes)
resetKey
private void resetKey()
- Resets the cipher's key. This is done after every reseed, which
combines the old key and the seed, and processes that throigh the
hash function.
incrementCounter
private void incrementCounter()
- Increment `counter' as a sixteen-byte little-endian unsigned integer
by one.
|
|||||||||
Home >> All >> gnu >> javax >> crypto >> [ prng overview ] | PREV CLASS NEXT CLASS | ||||||||
SUMMARY: ![]() ![]() ![]() |
DETAIL: FIELD | CONSTR | METHOD |