diff --git a/fortuna.cpp b/fortuna.cpp index 3debadd..7068ccb 100644 --- a/fortuna.cpp +++ b/fortuna.cpp @@ -23,6 +23,8 @@ namespace fortuna { Fortuna::~Fortuna() = default; auto Fortuna::random_data(unsigned int n_bytes) -> void { + incr_reseed_ctr(); + std::string n{R.Gen.generate_random_data(n_bytes)}; fmt::print("got you {} proper bytes from generate_random_data -> {}\n", n_bytes, n); diff --git a/fortuna.h b/fortuna.h index 691cf3a..9bbd903 100644 --- a/fortuna.h +++ b/fortuna.h @@ -23,6 +23,10 @@ public: Fortuna::R.null_da_ctr(); } + auto incr_reseed_ctr() -> void { + ++Fortuna::R.reseed_ctr; + } + auto initialize_prng() -> void { // TODO(me): handle the reseeds here as per Cryptography Engineering, // p. 153