Created
July 1, 2015 10:45
-
-
Save krisives/ae23628fd6e9f2f747cd to your computer and use it in GitHub Desktop.
This file contains hidden or 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 = 0xBADBEEF; | |
uint32_t i; | |
uint8_t digit; | |
const char *key; | |
char c; | |
if (argc < 2) { | |
printf("USAGE: prosum <cdkey>\n"); | |
return 1; | |
} | |
key = argv[1]; | |
if (strlen(key) != 8) { | |
printf("ERROR: cdkey must be 8 chars\n"); | |
return 1; | |
} | |
for (i=0; i < 8; i++) { | |
c = key[i]; | |
if (c < 'A' && c > 'F' && c < '0' && c > '9') { | |
printf("ERROR: cdkey must contain uppercase letters and numbers\n"); | |
return 1; | |
} | |
digit = (uint8_t)c; | |
check += (0x1337B00B * digit); | |
} | |
digit = ((check & 0xFF) / 2) * 2; | |
if (digit != 42) { | |
printf("ERROR: cdkey is invalid\n"); | |
return 1; | |
} | |
printf("Pro version unlocked\n"); | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment