mirror of
https://github.com/OpenNebula/one.git
synced 2025-03-21 14:50:08 +03:00
Better srand initialization
(cherry picked from commit 31e22f684fc8da83320188e5cec430e4182a9b39)
This commit is contained in:
parent
4e335128a6
commit
e27a5b9a7e
@ -203,9 +203,16 @@ string * one_util::aes256cbc_encrypt(const string& in, const string password)
|
||||
|
||||
string one_util::random_password()
|
||||
{
|
||||
static bool init = false;
|
||||
|
||||
ostringstream sstr;
|
||||
|
||||
srand(time(0));
|
||||
if (!init)
|
||||
{
|
||||
srand(time(0) + rand());
|
||||
init = true;
|
||||
}
|
||||
|
||||
sstr << rand();
|
||||
|
||||
return sha1_digest(sstr.str());
|
||||
|
Loading…
x
Reference in New Issue
Block a user