Add more entropy

This commit is contained in:
momo5502 2023-04-26 10:49:15 +02:00
parent deead46222
commit 0aebbf4ee2

View File

@ -1,5 +1,8 @@
#include "string.hpp" #include "string.hpp"
#include "cryptography.hpp" #include "cryptography.hpp"
#include <random>
#include "nt.hpp" #include "nt.hpp"
#include "finally.hpp" #include "finally.hpp"
@ -116,11 +119,17 @@ namespace utils::cryptography
int i[4]; // uninitialized data int i[4]; // uninitialized data
auto* i_ptr = &i; auto* i_ptr = &i;
this->add_entropy(reinterpret_cast<uint8_t*>(&i), sizeof(i)); this->add_entropy(&i, sizeof(i));
this->add_entropy(reinterpret_cast<uint8_t*>(&i_ptr), sizeof(i_ptr)); this->add_entropy(&i_ptr, sizeof(i_ptr));
auto t = time(nullptr); auto t = time(nullptr);
this->add_entropy(reinterpret_cast<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));
}
} }
}; };