Skip to content

Instantly share code, notes, and snippets.

@wolverine2k
Last active March 29, 2019 13:59
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save wolverine2k/14375e693421de45674459df2ca2423f to your computer and use it in GitHub Desktop.
Save wolverine2k/14375e693421de45674459df2ca2423f to your computer and use it in GitHub Desktop.
OldSoft's KeyGenMe #2 -- Upgraded from DOS by wolverine2k
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#define NAME_LENGTH 50
//#define IS_KEYGEN 1
void generateSerial(char* p_buffer)
{
int check1 = 0, check2 = 0;
for(unsigned int i = 1; i <= strlen(p_buffer); i++) {
check1 += p_buffer[i - 1] + i + 3;
}
check2 = (strlen(p_buffer) >> 1) * 3 + strlen(p_buffer);
sprintf(p_buffer, "%d-%d", check2, check1);
return;
}
int main(int argc, char** argv)
{
char name[NAME_LENGTH];
printf("OldSoft's KeyGenMe #2 -- Upgraded from DOS by wolverine2k\n");
printf("Enter your name: ");
scanf("%s", name);
#ifndef IS_KEYGEN
char serial[NAME_LENGTH];
printf("Enter a serial number: ");
scanf("%s", serial);
#endif
generateSerial(name);
#ifdef IS_KEYGEN
printf("Serial Number: %s\n", name);
#else
if(0 == strcmp(name, serial)) {
printf("\nGood Job. You have cracked OldSoft's KeyGenMe #2\n");
} else {
printf("\nTry Again!\n");
}
#endif
system("pause");
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment