diff --git a/generator.cpp b/generator.cpp index 0ff0e21..9c4848e 100644 --- a/generator.cpp +++ b/generator.cpp @@ -12,6 +12,20 @@ struct G_state{ unsigned __int128 ctr; }; +tuple reseed(G_state G, const string& s){ + unsigned __int128 ctr; + // TODO(me): conctatenate the key with seed + G.k = do_sha(G.ctr); + // return G, will need to get just k from that + return {G, ctr}; +} + +int64_t do_sha(int64_t key_with_seed){ + /* do sha256 */ + int64_t shastring = key_with_seed + 1; + return shastring; +} + G_state *initialize_generator(){ auto G = new G_state; G->k = 0; diff --git a/generator.h b/generator.h index 2c5712c..6335a28 100644 --- a/generator.h +++ b/generator.h @@ -12,6 +12,10 @@ G_state *initialize_generator(); std::string do_crypto(int64_t k, unsigned __int128 ctr); +std::tuple reseed(G_state G, const std::string& s); + +int64_t do_sha(int64_t key_with_seed); + std::tuple generate_blocks(G_state G, int k_blocks); /* returns output of 0 <= n <= 2^20 bytes */