fortuna/pool.h

45 lines
870 B
C
Raw Normal View History

#ifndef FORTUNA_POOL_H
#define FORTUNA_POOL_H
#include "util.h"
namespace fortuna {
namespace accumulator {
class Pool {
public:
2022-01-02 07:55:58 +01:00
Pool() noexcept {};
2022-01-03 02:49:23 +01:00
Pool(const Pool& pool) = delete; // no copy
2022-01-02 07:55:58 +01:00
~Pool() noexcept = default;
auto set_id(const unsigned int& id) noexcept -> void;
auto get_id() const noexcept -> unsigned int;
auto initialize_pool(const unsigned int& id) -> void;
// add entropy contained in a random event of 1 to 32 bytes
2022-01-10 05:07:18 +01:00
auto add_entropy(const uint source, const std::vector<char>& event) -> int;
auto get_s_length() const -> uint64_t;
auto get_s() const -> std::string;
auto clear_pool() -> void;
protected:
2022-01-10 05:07:18 +01:00
auto append_s(const std::string& entropy_s) -> void;
private:
unsigned int pool_id{0};
std::string s{""};
uint64_t size{0};
}; // class Pool
2022-01-10 04:25:03 +01:00
} // namespace accumulator
} // namespace fortuna
2022-01-10 04:25:03 +01:00
#endif // FORTUNA_POOL_H