25 #ifndef LCRNG_ORIGINAL_NUMBERS 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;
59 #ifndef CRYPTOPP_IMPORTS 63 m_size(m_cipher->BlockSize()),
65 m_randseed(seed, m_size),
67 m_deterministicTimeVector(deterministicTimeVector, deterministicTimeVector ? m_size : 0)
77 if (!deterministicTimeVector)
79 time_t tstamp1 = time(0);
82 clock_t tstamp2 =
clock();
105 time_t t = time(NULL);
116 throw SelfTestFailure(
"X917RNG: Continuous random number generator test failed.");
135 for (
unsigned i=0; i<
V; i++)
143 byte inByte = *inString++;
145 sum += log(
double(
n -
tab[inByte]));
157 double fTu = (
sum/(
n-
Q))/log(2.0);
159 double value = fTu * 0.1392;
160 return value > 1.0 ? 1.0 : value;
Base class for all exceptions thrown by the library.
unsigned int BytesNeeded() const
Provides the number of bytes of input is needed by the test.
void IncrementCounterByOne(byte *inout, unsigned int size)
Performs an addition with carry on a block of bytes.
virtual void GenerateBlock(byte *output, size_t size)
Generate random array of bytes.
#define NAMESPACE_BEGIN(x)
size_type size() const
Provides the count of elements in the SecBlock.
Some other error occurred not belonging to other categories.
const unsigned int m_size
size_t Put2(const byte *inString, size_t length, int messageEnd, bool blocking)
Input multiple bytes for processing.
Exception thrown when a crypto algorithm is used after a self test fails.
const T1 UnsignedMin(const T1 &a, const T2 &b)
Safe comparison of values that could be neagtive and incorrectly promoted.
void GenerateBlock(byte *output, size_t size)
Generate random array of bytes.
Miscellaneous classes for RNGs.
void GenerateIntoBufferedTransformation(BufferedTransformation &target, const std::string &channel, lword size)
Generate random bytes into a BufferedTransformation.
void xorbuf(byte *buf, const byte *mask, size_t count)
Performs an XOR of a buffer with a mask.
X917RNG(BlockTransformation *cipher, const byte *seed, const byte *deterministicTimeVector=0)
Construct a X917RNG.
SecByteBlock m_deterministicTimeVector
member_ptr< BlockTransformation > m_cipher
Classes and functions for the FIPS 140-2 validated library.
uint8_t const size_t const size
void * memcpy(void *a, const void *b, size_t c)
std::string IntToString(T value, unsigned int base=10)
Converts a value to a string.
double GetTestValue() const
MaurerRandomnessTest()
Construct a MaurerRandomnessTest.