generator: use de_hex()
All checks were successful
continuous-integration/drone/push Build is passing
All checks were successful
continuous-integration/drone/push Build is passing
This commit is contained in:
parent
fa9dc26f66
commit
c6bf1c7f52
|
@ -73,7 +73,7 @@ auto Generator::reseed(const std::string& s) -> void {
|
||||||
|
|
||||||
try {
|
try {
|
||||||
std::string a{fortuna::Util::do_sha(da_key + s)};
|
std::string a{fortuna::Util::do_sha(da_key + s)};
|
||||||
std::memmove(G.k, a.c_str(), G.k_length);
|
std::memmove(G.k, fortuna::Util::de_hex(a).c_str(), G.k_length);
|
||||||
++G.ctr;
|
++G.ctr;
|
||||||
fmt::print("[i] generator: reseeded\n");
|
fmt::print("[i] generator: reseeded\n");
|
||||||
}
|
}
|
||||||
|
@ -196,15 +196,7 @@ auto Generator::generate_random_data(const unsigned int& n) -> std::string {
|
||||||
try {
|
try {
|
||||||
std::string nu_G_k{generate_blocks(2)};
|
std::string nu_G_k{generate_blocks(2)};
|
||||||
// fmt::print("nu_G_k: {}\n", nu_G_k); // debugging
|
// fmt::print("nu_G_k: {}\n", nu_G_k); // debugging
|
||||||
std::string dst;
|
std::string dst{fortuna::Util::de_hex(nu_G_k)};
|
||||||
CryptoPP::HexDecoder decoder;
|
|
||||||
|
|
||||||
decoder.Put(reinterpret_cast<CryptoPP::byte*>(nu_G_k.data()),
|
|
||||||
nu_G_k.size());
|
|
||||||
decoder.MessageEnd();
|
|
||||||
dst.resize(G.k_length);
|
|
||||||
decoder.Get(reinterpret_cast<CryptoPP::byte*>(&dst[0]), dst.size());
|
|
||||||
|
|
||||||
|
|
||||||
nu_G_k.clear();
|
nu_G_k.clear();
|
||||||
|
|
||||||
|
|
Reference in New Issue