Created
July 1, 2015 11:10
-
-
Save krisives/634ae23db6c32722e149 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#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; | |
uint32_t y = 0; | |
do { | |
check = 0xBADBEEF; | |
for (i=0; i < 8; i++) { | |
x = (y >> (i * 4)) % 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++; | |
y++; | |
printf("%s\n", key); | |
} 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