Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include <stdlib.h>
- #include <string.h>
- int main (int argc, char *argv[])
- {
- if (argc < 2 || strlen(argv[1]) < 10) {
- printf("./keygen 'yourname' (10 chars minimal)\n");
- return 1;
- }
- char *name = argv[1];
- int j = 0xc0;
- for (int i = 0; i < strlen(name); i++) {
- char c = name[i];
- c = c ^ j;
- c = c & 3;
- c = c << 1;
- switch(c) {
- case 0:
- // Do nothing
- break;
- case 2:
- name[i] = name[i] - c;
- break;
- case 4:
- name[i] = name[i] ^ c;
- break;
- case 6:
- name[i]= (c << 1) ^ name[i];
- break;
- default:
- printf("Unexpected value encountered");
- return 1;
- }
- j += 1;
- printf("%x", name[i]);
- }
- printf("\n");
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement