2014-12-11 10:50:15 +03:00
|
|
|
// Copyright (c) 2012-2014 Konstantin Isakov <ikm@zbackup.org> and ZBackup contributors, see CONTRIBUTORS
|
2014-10-10 13:50:55 +04:00
|
|
|
// Part of ZBackup. Licensed under GNU GPLv2 or later + OpenSSL, see LICENSE
|
2013-07-18 21:33:25 +04:00
|
|
|
|
2015-01-25 19:44:15 +03:00
|
|
|
#ifndef RANDOM_HH_INCLUDED
|
|
|
|
#define RANDOM_HH_INCLUDED
|
2013-07-18 21:33:25 +04:00
|
|
|
|
|
|
|
#include <exception>
|
|
|
|
|
|
|
|
#include "ex.hh"
|
|
|
|
|
|
|
|
namespace Random {
|
|
|
|
DEF_EX( exCantGenerate, "Error generating random sequence, try later", std::exception )
|
|
|
|
|
|
|
|
/// This one fills the buffer with true randomness, suitable for a key
|
2014-12-15 14:13:34 +03:00
|
|
|
void generateTrue( void * buf, unsigned size );
|
2013-07-18 21:33:25 +04:00
|
|
|
/// This one fills the buffer with pseudo randomness, suitable for salts but not
|
|
|
|
/// keys
|
2014-12-15 14:13:34 +03:00
|
|
|
void generatePseudo( void * buf, unsigned size );
|
2013-07-18 21:33:25 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
#endif
|