fortuna/fortuna.cpp

37 lines
771 B
C++

#ifndef FORTUNA_FORTUNA_CPP
#define FORTUNA_FORTUNA_CPP
#include "fortuna.h"
#include <cryptopp/cryptlib.h>
#include <cryptopp/osrng.h>
#include <cryptopp/hex.h>
#include <cryptopp/filters.h>
#include <cryptopp/serpent.h>
#include <cryptopp/ccm.h>
#include <fmt/core.h>
namespace fortuna {
Fortuna::Fortuna(){
try {
initialize_prng();
} catch(CryptoPP::Exception& e) {
fmt::print(stderr, "{}\n", e.what());
}
}
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);
n.erase();
} //random_data
} // namespace fortuna
#endif//FORTUNA_FORTUNA_CPP