diff --git a/src/utils/cryptography.cpp b/src/utils/cryptography.cpp index 16da24e..78ce389 100644 --- a/src/utils/cryptography.cpp +++ b/src/utils/cryptography.cpp @@ -1,4 +1,5 @@ #include +#include #include "string.hpp" #include "cryptography.hpp" @@ -107,11 +108,18 @@ namespace utils int i[4]; // uninitialized data auto* i_ptr = &i; - this->add_entropy(reinterpret_cast(&i), sizeof(i)); - this->add_entropy(reinterpret_cast(&i_ptr), sizeof(i_ptr)); + this->add_entropy(&i, sizeof(i)); + this->add_entropy(&i_ptr, sizeof(i_ptr)); - auto t = time(nullptr); - this->add_entropy(reinterpret_cast(&t), sizeof(t)); + const auto t = std::time(nullptr); + 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)); + } } };