summaryrefslogtreecommitdiffstats
path: root/src/crypto/prng.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/crypto/prng.h')
-rw-r--r--src/crypto/prng.h25
1 files changed, 15 insertions, 10 deletions
diff --git a/src/crypto/prng.h b/src/crypto/prng.h
index 03e0b72..cc15f1f 100644
--- a/src/crypto/prng.h
+++ b/src/crypto/prng.h
@@ -47,41 +47,46 @@ static const char rdev[] = "/dev/urandom";
using namespace Crypto;
-class PRNG {
- private:
+class PRNG
+{
+private:
std::ifstream randfile;
/* unimplemented to satisfy -Weffc++ */
- PRNG( const PRNG & );
- PRNG & operator=( const PRNG & );
+ PRNG( const PRNG& );
+ PRNG& operator=( const PRNG& );
- public:
+public:
PRNG() : randfile( rdev, std::ifstream::in | std::ifstream::binary ) {}
- void fill( void *dest, size_t size ) {
+ void fill( void* dest, size_t size )
+ {
if ( 0 == size ) {
return;
}
- randfile.read( static_cast<char *>( dest ), size );
+ randfile.read( static_cast<char*>( dest ), size );
if ( !randfile ) {
throw CryptoException( "Could not read from " + std::string( rdev ) );
}
}
- uint8_t uint8() {
+ uint8_t uint8()
+ {
uint8_t x;
fill( &x, 1 );
return x;
}
- uint32_t uint32() {
+ uint32_t uint32()
+ {
uint32_t x;
fill( &x, 4 );
return x;
}
- uint64_t uint64() {
+ uint64_t uint64()
+ {
uint64_t x;
fill( &x, 8 );
return x;