surtur
01eadae32f
All checks were successful
continuous-integration/drone/push Build is passing
* declare and implement Generator class and member methods * create an instance of Generator in main * call initialize_generator() from main
41 lines
952 B
C++
41 lines
952 B
C++
#ifndef FORTUNA_GENERATOR_H
|
|
#define FORTUNA_GENERATOR_H
|
|
|
|
#include <string>
|
|
#include <tuple>
|
|
|
|
namespace fortuna {
|
|
namespace generator {
|
|
|
|
using namespace std;
|
|
|
|
class Generator {
|
|
public:
|
|
void initialize_generator();
|
|
|
|
protected:
|
|
struct G_state;
|
|
auto get_state() -> Generator::G_state;
|
|
|
|
private:
|
|
int64_t k;
|
|
unsigned __int128 ctr;
|
|
|
|
auto reseed(Generator::G_state G, const string& s) -> Generator::G_state;
|
|
|
|
auto do_sha(int64_t key_with_seed) -> int64_t;
|
|
|
|
auto do_crypto(int64_t k, unsigned __int128 ctr) -> string;
|
|
|
|
/* TODO(me): lacking objects (no more!), we have to return both the state and the string */
|
|
auto generate_blocks(Generator::G_state G, int k_blocks) -> tuple<string, Generator::G_state>;
|
|
|
|
/* n is the number of random bytes to generate */
|
|
auto generate_random_data(Generator::G_state G, uint n) -> tuple<string, Generator::G_state>;
|
|
|
|
}; // class generator
|
|
|
|
} //namespace generator
|
|
} //namespace fortuna
|
|
#endif//FORTUNA_GENERATOR_H
|