Advertisement
TCB13

vive.c | STKeys ViveLaFrance Algorithm

Jul 11th, 2012
115
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 1.16 KB | None | 0 0
  1. /*
  2.     Author: Kevin Devine <wyse101 0x40 gmail.com>
  3.     WWW:    http://weiss.u40.hosting.digiweb.ie/
  4.     Date:   April 2008
  5.  
  6.     example input: CP0615JT109
  7.    
  8.     this is 1 other key generation algorithm
  9.  
  10.  */
  11. #include <stdio.h>
  12. #include <stdlib.h>
  13. #include <string.h>
  14.  
  15. typedef unsigned int u32;
  16. typedef unsigned char u8;
  17.  
  18. u8 secret[]="ViveLaFrance!\0";
  19.  
  20. int main(int argc, char **argv)
  21. {
  22.     u8 key[26+1];
  23.     u8 serialNumber[8]={0};
  24.     u8 *out = key;
  25.     u8 x,y;
  26.     u32 i;
  27.  
  28.     if( argc == 2 && strlen(argv[1]) == 11) {
  29.  
  30.       serialNumber[0] = argv[1][4];
  31.       serialNumber[1] = argv[1][5];
  32.       serialNumber[2] = argv[1][8];
  33.       serialNumber[3] = argv[1][9];
  34.       serialNumber[4] = argv[1][10];
  35.  
  36.       fprintf(stdout,"\nProcessing %s\n",serialNumber);
  37.  
  38.       for(i = 0;i < 13;i++) {
  39.  
  40.         x = (secret[i] ^ serialNumber[i % 5]);
  41.  
  42.         y = (x & 0x0f);
  43.         x = (x & 0xf0) >> 4;
  44.  
  45.         *out++ = (x >= 10) ? (x + '7') : (x + '0');
  46.         *out++ = (y >= 10) ? (y + '7') : (y + '0');
  47.       }
  48.      
  49.       fprintf(stdout,"Key = %s\n\n",key);
  50.  
  51.    } else fprintf(stdout,"\nUsage:%s <SERIAL NUMBER>\n\n",argv[0]);
  52. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement