Botan  1.11.10
auto_rng.h
Go to the documentation of this file.
1 /*
2 * Auto Seeded RNG
3 * (C) 2008 Jack Lloyd
4 *
5 * Distributed under the terms of the Botan license
6 */
7 
8 #ifndef BOTAN_AUTO_SEEDING_RNG_H__
9 #define BOTAN_AUTO_SEEDING_RNG_H__
10 
11 #include <botan/rng.h>
12 #include <string>
13 
14 namespace Botan {
15 
16 class BOTAN_DLL AutoSeeded_RNG : public RandomNumberGenerator
17  {
18  public:
19  void randomize(byte out[], size_t len)
20  { m_rng->randomize(out, len); }
21 
22  bool is_seeded() const { return m_rng->is_seeded(); }
23 
24  void clear() { m_rng->clear(); }
25 
26  std::string name() const { return m_rng->name(); }
27 
28  void reseed(size_t poll_bits = 256) { m_rng->reseed(poll_bits); }
29 
30  void add_entropy(const byte in[], size_t len)
31  { m_rng->add_entropy(in, len); }
32 
33  AutoSeeded_RNG() : m_rng(RandomNumberGenerator::make_rng()) {}
34  private:
35  std::unique_ptr<RandomNumberGenerator> m_rng;
36  };
37 
38 }
39 
40 #endif
void randomize(byte out[], size_t len)
Definition: auto_rng.h:19
void add_entropy(const byte in[], size_t len)
Definition: auto_rng.h:30
std::string name() const
Definition: auto_rng.h:26
void reseed(size_t poll_bits=256)
Definition: auto_rng.h:28
uint8_t byte
Definition: types.h:30
bool is_seeded() const
Definition: auto_rng.h:22