Cryptography Reference
In-Depth Information
while (!p.mod(BigIntegerMath.FOUR).equals(BigIntegerMath.THREE));
do {q=pg.getStrongPrime();}
while (!q.mod(BigIntegerMath.FOUR).equals(BigIntegerMath.THREE));
n=p.multiply(q);
}
//Fills an array of bytes with random data
public void fillBytes(byte[] array) {
for (int i=0;i<array.length;i++) {
//Seed is continually squared
seed=seed.multiply(seed).mod(n);
//Least significant byte of residue is the i-th random byte
byte b=seed.byteValue();
array[i]=b;
}
}
//Returns a single byte of pseudorandom data
public byte getRandomByte() {
seed=seed.multiply(seed).mod(n);
return seed.byteValue();
}
}
Figures 16.5, 16.6, and 16.7 are screen shots of the test applet (TestCSPRBGApplet).
You first enter a seed as a large integer, then press the button repeatedly to get random bytes,
which are displayed as decimal integers in the range
128 thru 127.
Micali-Schnorr Pseudorandom Bit Generator
To generate pseudorandom num-
bers or bitstreams:
1.
Choose two secret strong primes,
p
and
q
, and form
n
=
pq
.
Let
N
equal the bit length of
n
.
FIGURE 16.5
Search WWH ::




Custom Search