This repository has been archived on 2022-02-10. You can view files and clone it, but cannot push or open issues or pull requests.
fortuna/pool.h
surtur a1cbbb209e
All checks were successful
continuous-integration/drone/push Build is passing
handle PRNG state in R_state + accumulator basis
* handle the PRNG state with R_state nested class
* add a private property R holding PRNG state to Fortuna
* add R_state properties as defined in Cryptography Engineering:
  * a generator instance
  * a reseed counter
  * 32 pools that the collected entropy is to be distributed over

* add initial definition of the Pool object and its initialization

* attempt to initialize PRNG in Fortuna constructor. wrap the
  initialization call in a try-catch block like a cultured person
* erase the string used to print data from random_data() after it's been
  used
2021-12-04 00:40:39 +01:00

35 lines
566 B
C++

#ifndef FORTUNA_POOL_H
#define FORTUNA_POOL_H
#include <fmt/core.h>
namespace fortuna {
namespace accumulator {
class Pool {
public:
Pool(){};
~Pool() = default;
// TODO(me): this public setter should be fixed?
auto set_id(unsigned int id) -> void {
pool_id = id;
}
auto get_id() -> unsigned int;
auto initialize_pool(unsigned int id) -> void {
set_id(id);
fmt::print("Pool{{{}}} initialized to empty string\n", id);
}
private:
unsigned int pool_id{0};
}; // class Pool
} //namespace accumulator
} //namespace fortuna
#endif//FORTUNA_POOL_H