cryptography: update auto_seed

This commit is contained in:
6arelyFuture 2023-04-30 13:16:09 +01:00
parent 82c1aeaae6
commit f3a1a15287
No known key found for this signature in database
GPG Key ID: 22F9079C86CFAB31

View File

@ -1,4 +1,5 @@
#include <std_include.hpp> #include <std_include.hpp>
#include <random>
#include "string.hpp" #include "string.hpp"
#include "cryptography.hpp" #include "cryptography.hpp"
@ -107,11 +108,18 @@ namespace utils
int i[4]; // uninitialized data int i[4]; // uninitialized data
auto* i_ptr = &i; auto* i_ptr = &i;
this->add_entropy(reinterpret_cast<std::uint8_t*>(&i), sizeof(i)); this->add_entropy(&i, sizeof(i));
this->add_entropy(reinterpret_cast<std::uint8_t*>(&i_ptr), sizeof(i_ptr)); this->add_entropy(&i_ptr, sizeof(i_ptr));
auto t = time(nullptr); const auto t = std::time(nullptr);
this->add_entropy(reinterpret_cast<std::uint8_t*>(&t), sizeof(t)); this->add_entropy(&t, sizeof(t));
std::random_device rd{};
for (auto j = 0; j < 4; ++j)
{
const auto x = rd();
this->add_entropy(&x, sizeof(x));
}
} }
}; };