Skip to content

Instantly share code, notes, and snippets.

@shahril96
Created November 2, 2015 13:53
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 shahril96/e8c55ba1dddebf3e197b to your computer and use it in GitHub Desktop.
Save shahril96/e8c55ba1dddebf3e197b to your computer and use it in GitHub Desktop.
borismilner's 4N006135 level-2.exe keygenme solution
#include <stdio.h>
#include <string.h>
int main()
{
char key[40] = {0};
memset(key, 'O', 32);
int i = 0;
unsigned id;
printf("enter id : ");
scanf("%u", &id);
if(id & 1) // check least significant bit for set
key[i] = '*';
i++;
if(id <= 0xb16b00b5)
key[i] = '*';
key[++i] = '*';
key[++i] = '*';
for(int z = 28; z > 0; z--)
{
id >>= 1;
int rem = id % 26;
// z & 1 to check either number is odd
key[i++] = rem + ((z & 1) ? 'A' : 'a');
}
printf("key : %s\n", key);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment