Skip to content

Instantly share code, notes, and snippets.

@alexymik
Last active August 29, 2015 13:57
Show Gist options
  • Save alexymik/9390348 to your computer and use it in GitHub Desktop.
Save alexymik/9390348 to your computer and use it in GitHub Desktop.
Keygen for a certain program
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
int main(int argc, char** argv) {
//Todo: extract registry value automatically, more validation
//Date lives here:
//HKEY_LOCAL_MACHINE\HARDWARE\DESCRIPTION\System\SystemBiosDate
char user_date[9] = "08/25/11"; //Example date
int date_firsthalf = 0;
int date_secondhalf = 0;
int key = 0;
printf("Enter date: ");
scanf("%s", user_date);
if (strlen(user_date) == 8) {
date_firsthalf = *(int*)user_date;
date_secondhalf = *(int*)(user_date + 4);
key = date_firsthalf + date_secondhalf;
key ^= date_secondhalf;
key ^= 314159265;
key = abs(key);
printf("Magic= %i \n", key);
} else {
printf("Invalid Date\n");
}
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment