mirror of
https://gitee.com/an-tao/drogon.git
synced 2024-11-30 02:37:57 +08:00
Fix an error in the secureRandomString function (#1816)
This commit is contained in:
parent
645c2d8aaf
commit
9ffe1b267b
@ -1229,11 +1229,11 @@ std::string secureRandomString(size_t size)
|
||||
"+-";
|
||||
assert(chars.size() == 64);
|
||||
|
||||
trantor::utils::Hash256 hash;
|
||||
// batch up to 32 bytes of random data for efficiency. Calling
|
||||
// secureRandomBytes can be expensive.
|
||||
auto randByte = [&hash]() {
|
||||
static size_t i = 0;
|
||||
auto randByte = []() {
|
||||
thread_local trantor::utils::Hash256 hash;
|
||||
thread_local size_t i = 0;
|
||||
if (i == 0)
|
||||
{
|
||||
bool ok = trantor::utils::secureRandomBytes(&hash, sizeof(hash));
|
||||
|
Loading…
Reference in New Issue
Block a user