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

# 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         unsigned int Put2(const byte *begin, unsigned int, int messageEnd, bool blocking);
    00021
    00022         bool AnyRetrievable() const {return true;}
    00023         unsigned long MaxRetrievable() const {return ULONG_MAX;}
    00024
    00025         unsigned int TransferTo2(BufferedTransformation &target, unsigned long &transferBytes, const std::string &channel=NULL_CHANNEL, bool blocking=true);
    00026         unsigned int CopyRangeTo2(BufferedTransformation &target, unsigned long &begin, unsigned long end=ULONG_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, unsigned int size);
    00033
    00034         void IsolatedInitialize(const NameValuePairs &parameters) {}
    00035
    00036 protected:
    00037         void Stir();
    00038
    00039 private:
    00040         SecByteBlock pool, key;
    00041         unsigned int addPos, getPos;
    00042 };
    00043
    00044 NAMESPACE_END
    00045
    00046 #endif