monotone

monotone Mtn Source Tree

Root/cryptopp/randpool.h

1#ifndef CRYPTOPP_RANDPOOL_H
2#define CRYPTOPP_RANDPOOL_H
3
4#include "cryptlib.h"
5#include "filters.h"
6
7NAMESPACE_BEGIN(CryptoPP)
8
9//! Randomness Pool
10/*! This class can be used to generate
11pseudorandom bytes after seeding the pool with
12the Put() methods */
13class RandomPool : public RandomNumberGenerator,
14 public Bufferless<BufferedTransformation>
15{
16public:
17//! poolSize must be greater than 16
18RandomPool(unsigned int poolSize=384);
19
20unsigned int Put2(const byte *begin, unsigned int, int messageEnd, bool blocking);
21
22bool AnyRetrievable() const {return true;}
23unsigned long MaxRetrievable() const {return ULONG_MAX;}
24
25unsigned int TransferTo2(BufferedTransformation &target, unsigned long &transferBytes, const std::string &channel=NULL_CHANNEL, bool blocking=true);
26unsigned int CopyRangeTo2(BufferedTransformation &target, unsigned long &begin, unsigned long end=ULONG_MAX, const std::string &channel=NULL_CHANNEL, bool blocking=true) const
27{
28throw NotImplemented("RandomPool: CopyRangeTo2() is not supported by this store");
29}
30
31byte GenerateByte();
32void GenerateBlock(byte *output, unsigned int size);
33
34void IsolatedInitialize(const NameValuePairs &parameters) {}
35
36protected:
37void Stir();
38
39private:
40SecByteBlock pool, key;
41unsigned int addPos, getPos;
42};
43
44NAMESPACE_END
45
46#endif

Archive Download this file

Branches

Tags

Quick Links:     www.monotone.ca    -     Downloads    -     Documentation    -     Wiki    -     Code Forge    -     Build Status