diff options
Diffstat (limited to 'lib')
| -rw-r--r-- | lib/lib3.c | 32 | ||||
| -rw-r--r-- | lib/lib3.h | 5 |
2 files changed, 36 insertions, 1 deletions
@@ -129,3 +129,35 @@ int mt_19937() return (y & 0xFFFFFFFF); } + +int mt_19937_timestamp_orcale() +{ + sleep(random_number_between(40,1000)); + + unsigned int seed = time(NULL); + printf("timestamp orcale seed: %u\n", seed); + mt_19937_seed(seed); + + sleep(random_number_between(40,1000)); + + return mt_19937(); +} +/*** + * is there a more clever way to do this than brute force? + * + **/ +void mt_19937_brute_force_timestamp() +{ + unsigned int start = time(NULL); + int rnd = mt_19937_timestamp_orcale(); + unsigned int stop = time(NULL); + unsigned int i; + // try every seed between start and stop + for(i=start;start<=stop;i++) { + mt_19937_seed(i); + if (rnd == mt_19937()) { + printf("found seed: %u\n", i); + break; + } + } +} @@ -5,6 +5,8 @@ #include <string.h> #include <stdlib.h> #include <openssl/aes.h> +#include <unistd.h> +#include <time.h> #define BLOCKSIZE 16 @@ -29,5 +31,6 @@ int aes_ctr(char *in, int length_in, char *out, char *string_key, char *nonce); void mt_19937_seed(unsigned int seed); int mt_19937(); - +int mt_19937_timestamp_orcale(); +void mt_19937_brute_force_timestamp(); #endif |
