Botan  1.10.9
rng.cpp
Go to the documentation of this file.
1 /*
2 * Random Number Generator Base
3 * (C) 1999-2008 Jack Lloyd
4 *
5 * Distributed under the terms of the Botan license
6 */
7 
8 #include <botan/rng.h>
9 
10 #if defined(BOTAN_HAS_AUTO_SEEDING_RNG)
11  #include <botan/auto_rng.h>
12 #endif
13 
14 namespace Botan {
15 
16 /*
17 * Get a single random byte
18 */
20  {
21  byte out;
22  this->randomize(&out, 1);
23  return out;
24  }
25 
26 /*
27 * Create and seed a new RNG object
28 */
30  {
31 #if defined(BOTAN_HAS_AUTO_SEEDING_RNG)
32  return new AutoSeeded_RNG;
33 #endif
34 
35  throw Algorithm_Not_Found("RandomNumberGenerator::make_rng - no RNG found");
36  }
37 
38 }
virtual void randomize(byte output[], size_t length)=0
static RandomNumberGenerator * make_rng()
Definition: rng.cpp:29
unsigned char byte
Definition: types.h:22