aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorlloyd <[email protected]>2008-05-25 21:15:23 +0000
committerlloyd <[email protected]>2008-05-25 21:15:23 +0000
commitb69a04df1aff3e7a5d035f219453c7b261036e93 (patch)
treee7b5217bfecb125f0f6470489db942a97650bdeb /src
parent25609cd77358c4de86a9100dcd49b1d8ad07f19a (diff)
Add RandomNumberGenerator::next_byte, which just returns a single byte
value from the RNG. (Would an adapter class be more appropriate?)
Diffstat (limited to 'src')
-rw-r--r--src/base.cpp10
1 files changed, 10 insertions, 0 deletions
diff --git a/src/base.cpp b/src/base.cpp
index bae2f4618..3cca7c594 100644
--- a/src/base.cpp
+++ b/src/base.cpp
@@ -207,6 +207,16 @@ u32bit EntropySource::fast_poll(byte buf[], u32bit len)
}
/*************************************************
+* Get a single random byte *
+*************************************************/
+byte RandomNumberGenerator::next_byte()
+ {
+ byte out;
+ this->randomize(&out, 1);
+ return out;
+ }
+
+/*************************************************
* Add entropy to internal state *
*************************************************/
void RandomNumberGenerator::add_entropy(const byte random[], u32bit length)