forked from ak-fortuna/fortuna
fix(SeedFileManager): 6-byte seed file issue
there was a reggression in a series of commits that led to this issue, mainly revolving around the switch from hex-encoded output to raw bytes. the result was a seed file in which just the first 6 bytes were updated. this is now fixed refs:c4dcab3046
revertc9398a0bf4
This commit is contained in:
parent
5d1d25ecb4
commit
4176de2e12
|
@ -114,7 +114,7 @@ auto SeedFileManager::update_seed_file() -> void {
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string str_buff(reinterpret_cast<const char*>(&buff[0]),
|
std::string str_buff(reinterpret_cast<const char*>(&buff[0]),
|
||||||
buff.SizeInBytes());
|
buff.SizeInBytes() * 8);
|
||||||
|
|
||||||
this->_p_accumulator->call_reseed(str_buff);
|
this->_p_accumulator->call_reseed(str_buff);
|
||||||
write_seed_file();
|
write_seed_file();
|
||||||
|
@ -135,17 +135,11 @@ auto SeedFileManager::write_seed_file() -> void {
|
||||||
static_cast<unsigned int>(config.seed_f_length))};
|
static_cast<unsigned int>(config.seed_f_length))};
|
||||||
|
|
||||||
assert(da_buff.length() % 2 == 0);
|
assert(da_buff.length() % 2 == 0);
|
||||||
assert(da_buff.size() == config.seed_f_length * 2); // da_buff is
|
assert(da_buff.size() == config.seed_f_length);
|
||||||
// hex-encoded
|
|
||||||
|
|
||||||
// account for hex encoding that is returned from get_random_data(), i.e.
|
const size_t length{da_buff.length()}; // not hex-encoded anymore
|
||||||
// the total length is half of the actual number of characters
|
|
||||||
const size_t length{da_buff.length() / 2};
|
|
||||||
|
|
||||||
CryptoPP::StringSource src(
|
std::memmove(&buff[0], da_buff.c_str(), length);
|
||||||
da_buff.c_str(),
|
|
||||||
true /*pumpAll*/,
|
|
||||||
new CryptoPP::HexDecoder(new CryptoPP::ArraySink(&buff[0], length)));
|
|
||||||
|
|
||||||
fmt::print(stderr, "[*] sfm: writing seed file\n");
|
fmt::print(stderr, "[*] sfm: writing seed file\n");
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue