Skip to content

Instantly share code, notes, and snippets.

@krisives
Created July 1, 2015 10:59
Show Gist options
  • Save krisives/51560b489476bcb9cc62 to your computer and use it in GitHub Desktop.
Save krisives/51560b489476bcb9cc62 to your computer and use it in GitHub Desktop.
#include <stdio.h>
#include <string.h>
#include <stddef.h>
int main(int argc, const char **argv) {
uint32_t check;
uint32_t i;
uint8_t digit;
char key[9];
uint8_t x;
char c;
srand(time(NULL));
key[8] = '\0';
uint32_t tries = 0;
do {
check = 0xBADBEEF;
for (i=0; i < 8; i++) {
x = rand() % 16;
if (x < 10) {
c = '0' + (char)x;
} else {
c = 'a' + (char)(x - 10);
}
key[i] = c;
digit = (uint8_t)c;
check += (0x1337B00B * digit);
}
digit = ((check & 0xFF) / 2) * 2;
tries++;
} while (digit != 42);
printf("Cracked after %d tries\n", tries);
printf("CDKEY: %s\n", key);
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment