|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectedu.rit.crypto.MuH1Random
public class MuH1Random
Class MuH1Random provides a pseudorandom number generator (PRNG) based on the MicroHash-One (μH-1) 32-bit one-way hash function. To use the μH1 PRNG, construct a new instance of class MuH1Random or re-initialize an existing instance by calling the initialize() method; seed the PRNG by calling the accumulateSeed() method one or more times; and repeatedly call next() to generate a series of pseudorandom numbers.
The μH-1 PRNG does not have the goal of generating a highly random sequence of values. While the μH-1 PRNG does okay on statistical randomness tests, other PRNGs do a lot better. Rather, the μH-1 PRNG's goals are (a) to run quickly, and yet (b) to make it difficult for an attacker to predict the next value in the sequence, having observed the previous values in the sequence.
As with the μH-1 compression function, the μH-1 PRNG is intended to be
used in applications where it only has to withstand attack for a short time,
a few milliseconds at most. See class MuH1
for
further information.
Note: Class MuH1Random is multiple thread safe.
Constructor Summary | |
---|---|
MuH1Random()
Construct a new μH-1 PRNG. |
|
MuH1Random(int seed)
Construct a new μH-1 PRNG. |
|
MuH1Random(long seed)
Construct a new μH-1 PRNG. |
Method Summary | |
---|---|
void |
accumulateSeed(int seed)
Accumulate the given int seed value into this μH-1 PRNG. |
void |
accumulateSeed(long seed)
Accumulate the given long seed value into this μH-1 PRNG. |
void |
initialize()
Set this μH-1 PRNG to the initial state. |
int |
next()
Generate this μH-1 PRNG's next pseudorandom number. |
int |
next(int n)
Generate this μH-1 PRNG's next pseudorandom number in the range 0 through n-1. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public MuH1Random()
public MuH1Random(int seed)
seed
- Seed.public MuH1Random(long seed)
seed
- Seed.Method Detail |
---|
public void initialize()
public void accumulateSeed(int seed)
seed
- Seed.public void accumulateSeed(long seed)
seed
- Seed.public int next()
public int next(int n)
n
- Upper bound. Must be greater than zero.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |