~ubuntu-branches/debian/squeeze/pycryptopp/squeeze

« back to all changes in this revision

Viewing changes to cryptopp/randpool.h

  • Committer: Bazaar Package Importer
  • Author(s): Zooko O'Whielacronx
  • Date: 2009-06-22 22:20:50 UTC
  • Revision ID: james.westby@ubuntu.com-20090622222050-hbqmn50dt2kvoz5o
Tags: upstream-0.5.14
ImportĀ upstreamĀ versionĀ 0.5.14

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#ifndef CRYPTOPP_RANDPOOL_H
 
2
#define CRYPTOPP_RANDPOOL_H
 
3
 
 
4
#include "cryptlib.h"
 
5
#include "filters.h"
 
6
 
 
7
NAMESPACE_BEGIN(CryptoPP)
 
8
 
 
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
 
 
17
        bool CanIncorporateEntropy() const {return true;}
 
18
        void IncorporateEntropy(const byte *input, size_t length);
 
19
        void GenerateIntoBufferedTransformation(BufferedTransformation &target, const std::string &channel, lword size);
 
20
 
 
21
        // for backwards compatibility. use RandomNumberSource, RandomNumberStore, and RandomNumberSink for other BufferTransformation functionality
 
22
        void Put(const byte *input, size_t length) {IncorporateEntropy(input, length);}
 
23
 
 
24
private:
 
25
        FixedSizeSecBlock<byte, 32> m_key;
 
26
        FixedSizeSecBlock<byte, 16> m_seed;
 
27
        member_ptr<BlockCipher> m_pCipher;
 
28
        bool m_keySet;
 
29
};
 
30
 
 
31
NAMESPACE_END
 
32
 
 
33
#endif