sfm: smooth out yet other conversions
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
5d6b9b9b28
commit
f79395261f
|
@ -9,6 +9,7 @@
|
||||||
#include <fmt/core.h>
|
#include <fmt/core.h>
|
||||||
|
|
||||||
#include <fstream>
|
#include <fstream>
|
||||||
|
#include <cstdint>
|
||||||
#include <stdexcept>
|
#include <stdexcept>
|
||||||
#include <utility>
|
#include <utility>
|
||||||
|
|
||||||
|
@ -51,7 +52,7 @@ auto SeedFileManager::update_seed_file() -> void {
|
||||||
fortuna::SeedFileManager::RUNNING = true;
|
fortuna::SeedFileManager::RUNNING = true;
|
||||||
|
|
||||||
f_stream.read(reinterpret_cast<char*>(buff.BytePtr()),
|
f_stream.read(reinterpret_cast<char*>(buff.BytePtr()),
|
||||||
config.seed_f_length);
|
static_cast<int64_t>(config.seed_f_length));
|
||||||
if (static_cast<std::size_t>(f_stream.gcount()) !=
|
if (static_cast<std::size_t>(f_stream.gcount()) !=
|
||||||
config.seed_f_length) {
|
config.seed_f_length) {
|
||||||
std::string msg{"error reading seed from file"};
|
std::string msg{"error reading seed from file"};
|
||||||
|
@ -76,8 +77,8 @@ auto SeedFileManager::update_seed_file() -> void {
|
||||||
}
|
}
|
||||||
|
|
||||||
auto SeedFileManager::write_seed_file() -> void {
|
auto SeedFileManager::write_seed_file() -> void {
|
||||||
const std::size_t seed_file_length_blocks =
|
const std::size_t seed_file_length_blocks{
|
||||||
fortuna::Util::b2b(config.seed_f_length);
|
fortuna::Util::b2b(config.seed_f_length)};
|
||||||
CryptoPP::SecByteBlock buff{seed_file_length_blocks *
|
CryptoPP::SecByteBlock buff{seed_file_length_blocks *
|
||||||
fortuna::Util::gen_block_size};
|
fortuna::Util::gen_block_size};
|
||||||
std::string da_buff{accumulator.get_random_data(
|
std::string da_buff{accumulator.get_random_data(
|
||||||
|
@ -88,7 +89,7 @@ auto SeedFileManager::write_seed_file() -> void {
|
||||||
std::ofstream f_stream{config.seed_f_path,
|
std::ofstream f_stream{config.seed_f_path,
|
||||||
std::ios::binary | std::ios::trunc};
|
std::ios::binary | std::ios::trunc};
|
||||||
f_stream.write(reinterpret_cast<const char*>(buff.BytePtr()),
|
f_stream.write(reinterpret_cast<const char*>(buff.BytePtr()),
|
||||||
config.seed_f_length);
|
static_cast<int64_t>(config.seed_f_length));
|
||||||
fortuna::SeedFileManager::RUNNING = true;
|
fortuna::SeedFileManager::RUNNING = true;
|
||||||
}
|
}
|
||||||
catch (std::exception& e) {
|
catch (std::exception& e) {
|
||||||
|
|
Reference in New Issue