|
|
|||||||||||
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.CubicResiduePrng
CubicResidue Prng algorithm from NIST test package
Fix random p, prime, length 512 bits.
Fix random g, prime, length 512 bits. g < p.
Each prng iteration calculate g = g**3 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 |
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) |
CubicResiduePrng()
|
(package private) |
CubicResiduePrng(BigInteger p,
BigInteger g)
|
(package private) |
CubicResiduePrng(BigInteger p,
BigInteger g,
BigInteger g0)
|
(package private) |
CubicResiduePrng(int x)
|
Method Summary | |
BigInteger |
getG()
Secret key |
BigInteger |
getP()
Public key. |
long |
nextLong()
calculate g**3 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 key and seed for Cubic Residue 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
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 g0
reset method set g to g0.
Constructor Detail |
CubicResiduePrng()
CubicResiduePrng(int x)
CubicResiduePrng(BigInteger p, BigInteger g)
CubicResiduePrng(BigInteger p, BigInteger g, 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 getG()
public void reset()
|
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |