Crypto++
|
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 cryptographic quality 00011 pseudorandom bytes after seeding the pool with IncorporateEntropy() */ 00012 class CRYPTOPP_DLL RandomPool : public RandomNumberGenerator, public NotCopyable 00013 { 00014 public: 00015 RandomPool(); 00016 00017 bool CanIncorporateEntropy() const {return true;} 00018 void IncorporateEntropy(const byte *input, size_t length); 00019 void GenerateIntoBufferedTransformation(BufferedTransformation &target, const std::string &channel, lword size); 00020 00021 // for backwards compatibility. use RandomNumberSource, RandomNumberStore, and RandomNumberSink for other BufferTransformation functionality 00022 void Put(const byte *input, size_t length) {IncorporateEntropy(input, length);} 00023 00024 private: 00025 FixedSizeSecBlock<byte, 32> m_key; 00026 FixedSizeSecBlock<byte, 16> m_seed; 00027 member_ptr<BlockCipher> m_pCipher; 00028 bool m_keySet; 00029 }; 00030 00031 NAMESPACE_END 00032 00033 #endif