Skip to content

Instantly share code, notes, and snippets.

@packz
Created April 26, 2012 19:16
Show Gist options
  • Save packz/2502188 to your computer and use it in GitHub Desktop.
Save packz/2502188 to your computer and use it in GitHub Desktop.
#include<stdio.h>
#include<stdlib.h>
void print_key(char p[], int f) {
printf("key: ");
int cycle;
for (cycle = 0 ; cycle < 8 ; cycle++) {
printf("%c", p[cycle]);
}
printf("%c", f);
}
int main(int argc, char* argv[]) {
unsigned char key[] = {0x45, 0x36, 0xab, 0xc8, 0xcc, 0x11, 0xe3, 0x7a};
unsigned char password[9];
unsigned int final = 0;
int cycle;
srand( time( NULL ) );
do {
final = 0;
for (cycle = 0 ; cycle < 8 ; cycle++) {
password[cycle] = rand() % (0x7a - 0x21) + 0x21;
/*
if (!isalnum(password[cycle])) {
final = 0;
break;
}*/
final += (password[cycle]) ^ key[cycle];
}
print_key(password, 0x41);
printf("\r");
final &= 0xff;
} while( (final > 0x7a) || (final < 0x61) );
print_key(password, final);
printf("\n");
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment