Improve random number generator

This commit is contained in:
brenosilva
2012-06-15 12:43:29 +00:00
parent 563017fce6
commit 39fcad4566
2 changed files with 15 additions and 2 deletions

View File

@@ -125,15 +125,21 @@ char *normalize_path(modsec_rec *msr, char *input) {
*/
unsigned char *getkey(apr_pool_t *mp) {
unsigned short int length = 12;
struct glinear data;
uint64_t seed;
char output[13];
char *key = NULL;
output[length] = '\0';
srand((unsigned int) time(0));
seed = data.seed;
srand(data.seed);
while(length--) {
seed *= data.mul;
seed += data.add;
data.seed = seed % data.mod;
output[length] = (rand() % 94 + 33);
srand(rand());
srand(data.seed + rand() + time(0));
}
key = apr_psprintf(mp,"%s",output);