00001 /* 00002 * Random Number Generator Base 00003 * (C) 1999-2008 Jack Lloyd 00004 * 00005 * Distributed under the terms of the Botan license 00006 */ 00007 00008 #include <botan/rng.h> 00009 00010 #if defined(BOTAN_HAS_AUTO_SEEDING_RNG) 00011 #include <botan/auto_rng.h> 00012 #endif 00013 00014 namespace Botan { 00015 00016 /* 00017 * Get a single random byte 00018 */ 00019 byte RandomNumberGenerator::next_byte() 00020 { 00021 byte out; 00022 this->randomize(&out, 1); 00023 return out; 00024 } 00025 00026 /* 00027 * Create and seed a new RNG object 00028 */ 00029 RandomNumberGenerator* RandomNumberGenerator::make_rng() 00030 { 00031 #if defined(BOTAN_HAS_AUTO_SEEDING_RNG) 00032 return new AutoSeeded_RNG; 00033 #endif 00034 00035 throw Algorithm_Not_Found("RandomNumberGenerator::make_rng - no RNG found"); 00036 } 00037 00038 }
1.5.8