generate secret from range [0..characteristic] in c++

This commit is contained in:
jacekpoz 2024-05-10 22:02:25 +02:00
parent 6c30f7d432
commit 1409dc940b
Signed by: poz
SSH key fingerprint: SHA256:JyLeVWE4bF3tDnFeUpUaJsPsNlJyBldDGV/dIKSLyN8

View file

@ -17,7 +17,7 @@ public:
User(const DHSetup<T> &dh) { User(const DHSetup<T> &dh) {
std::random_device rand; std::random_device rand;
std::mt19937 gen(rand()); std::mt19937 gen(rand());
std::uniform_int_distribution<> dist(0); std::uniform_int_distribution<> dist(0, dh.getGenerator().characteristic());
this->secret = dist(gen); this->secret = dist(gen);
this->dh = dh; this->dh = dh;