25 #ifndef LCRNG_ORIGINAL_NUMBERS
26 const word32 LC_RNG::m=2147483647L;
27 const word32 LC_RNG::q=44488L;
29 const word16 LC_RNG::a=(
unsigned int)48271L;
30 const word16 LC_RNG::r=3399;
32 const word32 LC_RNG::m=2147483647L;
33 const word32 LC_RNG::q=127773L;
35 const word16 LC_RNG::a=16807;
36 const word16 LC_RNG::r=2836;
46 long test = a*lo - r*hi;
53 *output++ = byte((GETBYTE(seed, 0) ^ GETBYTE(seed, 1) ^ GETBYTE(seed, 2) ^ GETBYTE(seed, 3)));
59 #ifndef CRYPTOPP_IMPORTS
63 m_size(m_cipher->BlockSize()),
65 m_randseed(seed, m_size),
67 m_deterministicTimeVector(deterministicTimeVector, deterministicTimeVector ? m_size : 0)
73 memset(m_datetime, 0x00, m_size);
74 memset(m_lastBlock, 0x00, m_size);
77 if (!deterministicTimeVector)
79 time_t tstamp1 = time(0);
82 clock_t tstamp2 = clock();
96 if (m_deterministicTimeVector.
size())
98 m_cipher->
ProcessBlock(m_deterministicTimeVector, m_datetime);
105 time_t t = time(NULL);
111 xorbuf(m_randseed, m_datetime, m_size);
115 if (memcmp(m_lastBlock, m_randseed, m_size) == 0)
116 throw SelfTestFailure(
"X917RNG: Continuous random number generator test failed.");
124 memcpy(m_lastBlock, m_randseed, m_size);
125 xorbuf(m_randseed, m_datetime, m_size);
135 for (
unsigned i=0; i<V; i++)
143 byte inByte = *inString++;
145 sum += log(
double(n - tab[inByte]));
152 double MaurerRandomnessTest::GetTestValue()
const
157 double fTu = (sum/(n-Q))/log(2.0);
159 double value = fTu * 0.1392;
160 return value > 1.0 ? 1.0 : value;