randpool.h

00001 #ifndef CRYPTOPP_RANDPOOL_H
00002 #define CRYPTOPP_RANDPOOL_H
00003 
00004 #include "cryptlib.h"
00005 #include "filters.h"
00006 
00007 NAMESPACE_BEGIN(CryptoPP)
00008 
00009 //! Randomness Pool
00010 /*! This class can be used to generate
00011         pseudorandom bytes after seeding the pool with
00012         the Put() methods */
00013 class CRYPTOPP_DLL RandomPool : public RandomNumberGenerator,
00014                                    public Bufferless<BufferedTransformation>
00015 {
00016 public:
00017         //! poolSize must be greater than 16
00018         RandomPool(unsigned int poolSize=384);
00019 
00020         size_t Put2(const byte *begin, size_t length, int messageEnd, bool blocking);
00021 
00022         bool AnyRetrievable() const {return true;}
00023         lword MaxRetrievable() const {return ULONG_MAX;}
00024 
00025         size_t TransferTo2(BufferedTransformation &target, lword &transferBytes, const std::string &channel=NULL_CHANNEL, bool blocking=true);
00026         size_t CopyRangeTo2(BufferedTransformation &target, lword &begin, lword end=LWORD_MAX, const std::string &channel=NULL_CHANNEL, bool blocking=true) const
00027         {
00028                 throw NotImplemented("RandomPool: CopyRangeTo2() is not supported by this store");
00029         }
00030 
00031         byte GenerateByte();
00032         void GenerateBlock(byte *output, size_t size);
00033 
00034         void IsolatedInitialize(const NameValuePairs &parameters) {}
00035 
00036 protected:
00037         void Stir();
00038 
00039 private:
00040         SecByteBlock pool, key;
00041         size_t addPos, getPos;
00042 };
00043 
00044 NAMESPACE_END
00045 
00046 #endif

Generated on Sat Dec 23 02:07:09 2006 for Crypto++ by  doxygen 1.5.1-p1