blob: aa9b73ff39ad392724e596b364f94511ff0f6c35 (
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
37
38
|
/*
* Random Number Generator Base
* (C) 1999-2008 Jack Lloyd
*
* Distributed under the terms of the Botan license
*/
#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");
}
}
|