Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | File List | Class Members | File Members

RandomNumberGenerator Class Reference

#include <cryptlib.h>

Inheritance diagram for RandomNumberGenerator:

Algorithm Clonable ARC4_Base AutoSeededX917RNG< BLOCK_CIPHER > BlockingRng ClassNullRNG LC_RNG NonblockingRng PublicBlumBlumShub RandomPool X917RNG List of all members.

Detailed Description

interface for random number generators

All return values are uniformly distributed over the range specified.

Definition at line 618 of file cryptlib.h.

Public Member Functions

virtual byte GenerateByte ()=0
 generate new random byte and return it
virtual unsigned int GenerateBit ()
 generate new random bit and return it
virtual word32 GenerateWord32 (word32 a=0, word32 b=0xffffffffL)
 generate a random 32 bit word in the range min to max, inclusive
virtual void GenerateBlock (byte *output, unsigned int size)
 generate random array of bytes
virtual void DiscardBytes (unsigned int n)
 generate and discard n bytes
template<class IT> void Shuffle (IT begin, IT end)
 randomly shuffle the specified array, resulting permutation is uniformly distributed
virtual std::string AlgorithmName () const
 returns name of this algorithm, not universally implemented yet
virtual ClonableClone () const
 this is not implemented by most classes yet


Member Function Documentation

unsigned int RandomNumberGenerator::GenerateBit  )  [virtual]
 

generate new random bit and return it

Default implementation is to call GenerateByte() and return its parity.

Reimplemented in PublicBlumBlumShub.

Definition at line 111 of file cryptlib.cpp.

References GenerateByte().

void RandomNumberGenerator::GenerateBlock byte *  output,
unsigned int  size
[virtual]
 

generate random array of bytes

Default implementation is to call GenerateByte() size times.

Reimplemented in NonblockingRng, BlockingRng, and RandomPool.

Definition at line 116 of file cryptlib.cpp.

References GenerateByte().

Referenced by DL_GroupParameters_DSA::GenerateRandom().

void RandomNumberGenerator::DiscardBytes unsigned int  n  )  [virtual]
 

generate and discard n bytes

Default implementation is to call GenerateByte() n times.

Reimplemented in ARC4_Base.

Definition at line 142 of file cryptlib.cpp.

References GenerateByte().


The documentation for this class was generated from the following files:
Generated on Wed Jul 21 19:16:05 2004 for Crypto++ by doxygen 1.3.7-20040704