home *** CD-ROM | disk | FTP | other *** search
/ Reverse Code Engineering RCE CD +sandman 2000 / ReverseCodeEngineeringRceCdsandman2000.iso / RCE / +Sandman / Imperium / easy / unseek.cpp < prev   
Encoding:
C/C++ Source or Header  |  2000-05-25  |  1.6 KB  |  74 lines

  1. #include <math.h>
  2. #include <stdio.h>
  3. #include <conio.h>
  4. #include <stdlib.h>
  5. #include <string.h>
  6.  
  7. const char* al="AH2ypN(TZ>RCKi*z;U7G)?dQ<Je]0-=~M$%ahruoSnWEx4YFqmL(5`IOPB}|s6g:#&Vj+l1_[cvD,9./^f3@tXbw!k8";
  8.  
  9.  
  10. //return the first 2 char in a string as a integer and strip 2 first char off string
  11. int stoi(char* st)
  12. {
  13.  int i;
  14.  i = ((st[0]&0x0F)*10+(st[1]&0x0F));
  15.  strcpy(st, &st[2]);
  16.  return i;
  17. }
  18.  
  19. //return the index of char c in string al
  20. int GetCharIndex(char c)
  21.  
  22. {
  23.  int i;
  24.  for (i=0; i<strlen(al); i++)
  25.  {
  26.   if (al[i] == c) return i;
  27.  }
  28.  printf("error\n");
  29.  return 0;
  30. }
  31.  
  32. //extract the first string from a crypted source (wich may contain more)
  33. void DecryptString(char* dest, char* source, int a)
  34.  
  35. {
  36.  int i;
  37.  int tok_len;
  38.  char buff[2];
  39.  
  40.  buff[1]=0;
  41.  tok_len = stoi(source)-89;      //2 first char = length
  42.  for (i=0; i<tok_len; i++)       //loop for each char in current token
  43.  {
  44.   buff[0] =  al[stoi(source)-a]; //use buff as an gateway between char and "string"
  45.   strcat(dest, buff);
  46.  }
  47.  strcat(dest,"*");                     //use the * as a separator
  48. }
  49.  
  50.  
  51. void main(void)
  52.  
  53. {
  54.  char buff[30]="";   //will hold decrypted string
  55.  char inputstring[80]; //will contain crypted source
  56.  int a_offset;
  57.  
  58. // strcpy(inputstring,"96989446449274312767319618656144923142");
  59.  printf("enter string to convert : ");
  60.  scanf("%s", inputstring);
  61.  
  62.  printf("\ndecrypting : '%s' -> ", inputstring);
  63.  
  64.  a_offset = stoi(inputstring)-91;    //get special 'a_offset'
  65.  
  66.  while(strlen(inputstring)>12)       //loop for each token
  67.  {
  68.   DecryptString(buff, inputstring, a_offset);
  69.  }
  70.  printf("%s\n", buff);
  71.  
  72.  int ch = getch();
  73. }
  74.