Botan
1.10.9
Main Page
Related Pages
Namespaces
Classes
Files
File List
File Members
src
rng
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
*/
19
byte
RandomNumberGenerator::next_byte
()
20
{
21
byte
out;
22
this->
randomize
(&out, 1);
23
return
out;
24
}
25
26
/*
27
* Create and seed a new RNG object
28
*/
29
RandomNumberGenerator
*
RandomNumberGenerator::make_rng
()
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
}
Botan::RandomNumberGenerator::randomize
virtual void randomize(byte output[], size_t length)=0
Botan::RandomNumberGenerator
Definition:
rng.h:20
Botan::RandomNumberGenerator::make_rng
static RandomNumberGenerator * make_rng()
Definition:
rng.cpp:29
Botan::byte
unsigned char byte
Definition:
types.h:22
Botan::AutoSeeded_RNG
Definition:
auto_rng.h:20
Botan
Definition:
algo_base.h:14
Botan::Algorithm_Not_Found
Definition:
exceptn.h:109
Botan::RandomNumberGenerator::next_byte
byte next_byte()
Definition:
rng.cpp:19
Generated on Sat Aug 20 2016 08:18:48 for Botan by
1.8.9.1