00001 #ifndef CRYPTOPP_RANDPOOL_H 00002 #define CRYPTOPP_RANDPOOL_H 00003 00004 #include "cryptlib.h" 00005 #include "filters.h" 00006 #include "secblock.h" 00007 #include "smartptr.h" 00008 #include "aes.h" 00009 00010 NAMESPACE_BEGIN(CryptoPP) 00011 00012 //! Randomness Pool 00013 /*! This class can be used to generate cryptographic quality 00014 pseudorandom bytes after seeding the pool with IncorporateEntropy() */ 00015 class CRYPTOPP_DLL RandomPool : public RandomNumberGenerator, public NotCopyable 00016 { 00017 public: 00018 RandomPool(); 00019 00020 bool CanIncorporateEntropy() const {return true;} 00021 void IncorporateEntropy(const byte *input, size_t length); 00022 void GenerateIntoBufferedTransformation(BufferedTransformation &target, const std::string &channel, lword size); 00023 00024 // for backwards compatibility. use RandomNumberSource, RandomNumberStore, and RandomNumberSink for other BufferTransformation functionality 00025 void Put(const byte *input, size_t length) {IncorporateEntropy(input, length);} 00026 00027 private: 00028 FixedSizeSecBlock<byte, 32> m_key; 00029 FixedSizeSecBlock<byte, 16> m_seed; 00030 member_ptr<BlockCipher> m_pCipher; 00031 bool m_keySet; 00032 }; 00033 00034 NAMESPACE_END 00035 00036 #endif