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

RandomPool Class Reference

#include <randpool.h>

Inheritance diagram for RandomPool:

RandomNumberGenerator Algorithm Clonable AutoSeededRandomPool List of all members.

Detailed Description

Randomness Pool.

This class can be used to generate pseudorandom bytes after seeding the pool with the Put() methods

Definition at line 13 of file randpool.h.

Public Member Functions

 RandomPool (unsigned int poolSize=384)
 poolSize must be greater than 16

unsigned int Put2 (const byte *begin, unsigned int, int messageEnd, bool blocking)
bool AnyRetrievable () const
unsigned long MaxRetrievable () const
unsigned int TransferTo2 (BufferedTransformation &target, unsigned long &transferBytes, const std::string &channel=NULL_CHANNEL, bool blocking=true)
unsigned int CopyRangeTo2 (BufferedTransformation &target, unsigned long &begin, unsigned long end=ULONG_MAX, const std::string &channel=NULL_CHANNEL, bool blocking=true) const
byte GenerateByte ()
 generate new random byte and return it

void GenerateBlock (byte *output, unsigned int size)
 generate random array of bytes

void IsolatedInitialize (const NameValuePairs &parameters)
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 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


Protected Member Functions

void Stir ()


Member Function Documentation

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

generate random array of bytes

Default implementation is to call GenerateByte() size times.

Reimplemented from RandomNumberGenerator.

Definition at line 94 of file randpool.cpp.

unsigned int RandomNumberGenerator::GenerateBit  )  [virtual, inherited]
 

generate new random bit and return it

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

Reimplemented in PublicBlumBlumShub.

Definition at line 83 of file cryptlib.cpp.

References RandomNumberGenerator::GenerateByte().

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

generate and discard n bytes

Default implementation is to call GenerateByte() n times.

Reimplemented in ARC4_Base.

Definition at line 114 of file cryptlib.cpp.

References RandomNumberGenerator::GenerateByte().


The documentation for this class was generated from the following files:
Generated on Mon Apr 19 18:12:45 2004 for Crypto++ by doxygen 1.3.6-20040222