|
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object com.fasteasytrade.JRandTest.Algo.Cipher com.fasteasytrade.JRandTest.Algo.ModulusExponentPrng
ModulusExponent Prng algorithm from NIST test package
Fix random p, prime, length 512 bits.
Fix random g, prime, length 512 bits. g < p.
Fix random e, prime, length 160 bits.
Each prng iteration calculate g = g**e mod p.
The lowest 64 bits of g are the prng result.
Field Summary | |
int |
bit_length
p and g length/num of bits |
(package private) BigInteger |
e
Initial e is a random prime (with probability < 2 ** -100) Length of e is e_bit_length = 160 bits = 20 bytes. |
int |
e_bit_length
e length/num of bits |
(package private) BigInteger |
g
Initial g is a random prime (with probability < 2 ** -100) Length of g is bit_length = 512 bits = 64 bytes. |
(package private) BigInteger |
g0
g0 is the "initial state" of the prng. |
(package private) BigInteger |
p
prime (with probability < 2 ** -100). |
Constructor Summary | |
(package private) |
ModulusExponentPrng()
|
(package private) |
ModulusExponentPrng(BigInteger p,
BigInteger g,
BigInteger e)
|
(package private) |
ModulusExponentPrng(BigInteger p,
BigInteger g,
BigInteger e,
BigInteger g0)
|
(package private) |
ModulusExponentPrng(int x)
|
Method Summary | |
BigInteger |
getE()
Public key. |
BigInteger |
getG()
Secret key |
BigInteger |
getP()
Public key. |
long |
nextLong()
calculate g**e mod p and returns lowest 64 bits, long. |
void |
reset()
Reset "state" of prng by setting g to g0 (initial g). |
(package private) void |
setup(int len)
Generate the keys and seed for Modulus Exponent Prng. |
Methods inherited from class com.fasteasytrade.JRandTest.Algo.Cipher |
compareBytes |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
public final int bit_length
public final int e_bit_length
BigInteger p
Length of p is bit_length = 512 bits = 64 bytes.
BigInteger g
Length of g is bit_length = 512 bits = 64 bytes.
g is the "state" of the prng.
g = take 64 lowr bits of ( g**3 mod n ).
BigInteger e
Length of e is e_bit_length = 160 bits = 20 bytes.
e is the "exponent" of the prng.
BigInteger g0
reset method set g to g0.
Constructor Detail |
ModulusExponentPrng()
ModulusExponentPrng(int x)
ModulusExponentPrng(BigInteger p, BigInteger g, BigInteger e)
ModulusExponentPrng(BigInteger p, BigInteger g, BigInteger e, BigInteger g0)
Method Detail |
void setup(int len)
Select random primes - p, g. g < p.
len
- length of p and g, num of bits.public long nextLong()
public BigInteger getP()
public BigInteger getE()
public BigInteger getG()
public void reset()
|
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |