blob: fe3c4e10c39b1c339f18e3b948dd294d0d19ec53 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
|
/*************************************************
* Random Number Generator Base Source File *
* (C) 1999-2008 Jack Lloyd *
*************************************************/
#include <botan/rng.h>
#if defined(BOTAN_HAS_AUTO_SEEDING_RNG)
#include <botan/auto_rng.h>
#endif
namespace Botan {
/*************************************************
* Get a single random byte *
*************************************************/
byte RandomNumberGenerator::next_byte()
{
byte out;
this->randomize(&out, 1);
return out;
}
/*************************************************
* Create and seed a new RNG object *
*************************************************/
RandomNumberGenerator* RandomNumberGenerator::make_rng()
{
#if defined(BOTAN_HAS_AUTO_SEEDING_RNG)
return new AutoSeeded_RNG;
#endif
throw Algorithm_Not_Found("RandomNumberGenerator::make_rng - no RNG found");
}
}
|