Team Fortress 2 Source Code as on 22/4/2020
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

36 lines
1.0 KiB

  1. #ifndef CRYPTOPP_RANDPOOL_H
  2. #define CRYPTOPP_RANDPOOL_H
  3. #include "cryptlib.h"
  4. #include "filters.h"
  5. #include "secblock.h"
  6. #include "smartptr.h"
  7. #include "aes.h"
  8. NAMESPACE_BEGIN(CryptoPP)
  9. //! Randomness Pool
  10. /*! This class can be used to generate cryptographic quality
  11. pseudorandom bytes after seeding the pool with IncorporateEntropy() */
  12. class CRYPTOPP_DLL RandomPool : public RandomNumberGenerator, public NotCopyable
  13. {
  14. public:
  15. RandomPool();
  16. bool CanIncorporateEntropy() const {return true;}
  17. void IncorporateEntropy(const byte *input, size_t length);
  18. void GenerateIntoBufferedTransformation(BufferedTransformation &target, const std::string &channel, lword size);
  19. // for backwards compatibility. use RandomNumberSource, RandomNumberStore, and RandomNumberSink for other BufferTransformation functionality
  20. void Put(const byte *input, size_t length) {IncorporateEntropy(input, length);}
  21. private:
  22. FixedSizeSecBlock<byte, 32> m_key;
  23. FixedSizeSecBlock<byte, 16> m_seed;
  24. member_ptr<BlockCipher> m_pCipher;
  25. bool m_keySet;
  26. };
  27. NAMESPACE_END
  28. #endif