add reseed() and do_sha() functions
All checks were successful
continuous-integration/drone/push Build is passing

currently the bodies of the functions are pretty much bogus
This commit is contained in:
surtur 2021-10-30 21:06:54 +02:00
parent 92946eec91
commit 46e5048788
Signed by: wanderer
GPG Key ID: 19CE1EC1D9E0486D
2 changed files with 18 additions and 0 deletions

View File

@ -12,6 +12,20 @@ struct G_state{
unsigned __int128 ctr;
};
tuple<G_state, unsigned __int128> 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;

View File

@ -12,6 +12,10 @@ G_state *initialize_generator();
std::string do_crypto(int64_t k, unsigned __int128 ctr);
std::tuple<G_state, unsigned __int128> reseed(G_state G, const std::string& s);
int64_t do_sha(int64_t key_with_seed);
std::tuple<std::string, G_state> generate_blocks(G_state G, int k_blocks);
/* returns output of 0 <= n <= 2^20 bytes */