summaryrefslogtreecommitdiff
path: root/src-cryptopp/randpool.h
diff options
context:
space:
mode:
authorMicah Anderson <micah@riseup.net>2013-08-22 16:39:52 -0400
committerMicah Anderson <micah@riseup.net>2013-08-22 16:57:38 -0400
commit6d35b188b668c5007409e63a15e8340ed34dcfb8 (patch)
treec9dd25f3675b3b6f9b29b0786057f8a4d377bc2b /src-cryptopp/randpool.h
parent86a1089dc6694f58d0f3356bdf9c8fe4061421f5 (diff)
parent5e60e0e3af85f22aa0afe8bf0ecf85619afacfeb (diff)
Merge tag 'upstream/0.6.0.12'
Upstream version 0.6.0.12
Diffstat (limited to 'src-cryptopp/randpool.h')
-rw-r--r--src-cryptopp/randpool.h33
1 files changed, 33 insertions, 0 deletions
diff --git a/src-cryptopp/randpool.h b/src-cryptopp/randpool.h
new file mode 100644
index 0000000..c25bc9b
--- /dev/null
+++ b/src-cryptopp/randpool.h
@@ -0,0 +1,33 @@
+#ifndef CRYPTOPP_RANDPOOL_H
+#define CRYPTOPP_RANDPOOL_H
+
+#include "cryptlib.h"
+#include "filters.h"
+
+NAMESPACE_BEGIN(CryptoPP)
+
+//! Randomness Pool
+/*! This class can be used to generate cryptographic quality
+ pseudorandom bytes after seeding the pool with IncorporateEntropy() */
+class CRYPTOPP_DLL RandomPool : public RandomNumberGenerator, public NotCopyable
+{
+public:
+ RandomPool();
+
+ bool CanIncorporateEntropy() const {return true;}
+ void IncorporateEntropy(const byte *input, size_t length);
+ void GenerateIntoBufferedTransformation(BufferedTransformation &target, const std::string &channel, lword size);
+
+ // for backwards compatibility. use RandomNumberSource, RandomNumberStore, and RandomNumberSink for other BufferTransformation functionality
+ void Put(const byte *input, size_t length) {IncorporateEntropy(input, length);}
+
+private:
+ FixedSizeSecBlock<byte, 32> m_key;
+ FixedSizeSecBlock<byte, 16> m_seed;
+ member_ptr<BlockCipher> m_pCipher;
+ bool m_keySet;
+};
+
+NAMESPACE_END
+
+#endif