#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <time.h>
#define KEY_SIZE 32
#define BUFF_SIZE 1024
unsigned int holdrand = 1354316400;
static int Rand (void) {
return(((holdrand = holdrand * 214013L + 2531011L) >> 16) & 0x7fff);
}
char* genere_key(void) {
int i;
static char key[KEY_SIZE+1];
const char charset[] =
"abcdefghijklmnopqrstuvwxyz"
"ABCDEFGHIJKLMNOPQRSTUVWXYZ"
"123456789";
for(i = 0; i < KEY_SIZE; i++) {
key[i] = charset[Rand() % (sizeof(charset) - 1)];
}
key[KEY_SIZE] = '\0';
return key;
}
int main ()
{
char *key;
key = genere_key();
printf("[+] Using key : %s\n", key
);
}
I2luY2x1ZGUgPHN0ZGlvLmg+CiNpbmNsdWRlIDxzdGRsaWIuaD4KI2luY2x1ZGUgPHN0cmluZy5oPgojaW5jbHVkZSA8dGltZS5oPgoKI2RlZmluZSBLRVlfU0laRSAzMgojZGVmaW5lIEJVRkZfU0laRSAxMDI0Cgp1bnNpZ25lZCBpbnQgaG9sZHJhbmQgPSAxMzU0MzE2NDAwOwoKc3RhdGljIGludCBSYW5kICh2b2lkKSB7CiAgcmV0dXJuKCgoaG9sZHJhbmQgPSBob2xkcmFuZCAqIDIxNDAxM0wgKyAyNTMxMDExTCkgPj4gMTYpICYgMHg3ZmZmKTsKfQoKCiBjaGFyKiBnZW5lcmVfa2V5KHZvaWQpIHsKICBpbnQgaTsKICBzdGF0aWMgY2hhciBrZXlbS0VZX1NJWkUrMV07CiAgY29uc3QgY2hhciBjaGFyc2V0W10gPSAKICAgICJhYmNkZWZnaGlqa2xtbm9wcXJzdHV2d3h5eiIKICAgICJBQkNERUZHSElKS0xNTk9QUVJTVFVWV1hZWiIKICAgICIxMjM0NTY3ODkiOwogIAogIGZvcihpID0gMDsgaSA8IEtFWV9TSVpFOyBpKyspIHsKICAgIGtleVtpXSA9IGNoYXJzZXRbUmFuZCgpICUgKHNpemVvZihjaGFyc2V0KSAtIDEpXTsKICB9CiAga2V5W0tFWV9TSVpFXSA9ICdcMCc7CgogIHJldHVybiBrZXk7Cn0KCmludCBtYWluICgpCnsKCmNoYXIgKmtleTsKa2V5ID0gZ2VuZXJlX2tleSgpOwpwcmludGYoIlsrXSBVc2luZyBrZXkgOiAlc1xuIiwga2V5KTsKCn0K