home *** CD-ROM | disk | FTP | other *** search
- #include <math.h>
- #include <stdio.h>
- #include <conio.h>
- #include <stdlib.h>
- #include <string.h>
-
- const char* al="AH2ypN(TZ>RCKi*z;U7G)?dQ<Je]0-=~M$%ahruoSnWEx4YFqmL(5`IOPB}|s6g:#&Vj+l1_[cvD,9./^f3@tXbw!k8";
-
-
- //return the first 2 char in a string as a integer and strip 2 first char off string
- int stoi(char* st)
- {
- int i;
- i = ((st[0]&0x0F)*10+(st[1]&0x0F));
- strcpy(st, &st[2]);
- return i;
- }
-
- //return the index of char c in string al
- int GetCharIndex(char c)
-
- {
- int i;
- for (i=0; i<strlen(al); i++)
- {
- if (al[i] == c) return i;
- }
- printf("error\n");
- return 0;
- }
-
- //extract the first string from a crypted source (wich may contain more)
- void DecryptString(char* dest, char* source, int a)
-
- {
- int i;
- int tok_len;
- char buff[2];
-
- buff[1]=0;
- tok_len = stoi(source)-89; //2 first char = length
- for (i=0; i<tok_len; i++) //loop for each char in current token
- {
- buff[0] = al[stoi(source)-a]; //use buff as an gateway between char and "string"
- strcat(dest, buff);
- }
- strcat(dest,"*"); //use the * as a separator
- }
-
-
- void main(void)
-
- {
- char buff[30]=""; //will hold decrypted string
- char inputstring[80]; //will contain crypted source
- int a_offset;
-
- // strcpy(inputstring,"96989446449274312767319618656144923142");
- printf("enter string to convert : ");
- scanf("%s", inputstring);
-
- printf("\ndecrypting : '%s' -> ", inputstring);
-
- a_offset = stoi(inputstring)-91; //get special 'a_offset'
-
- while(strlen(inputstring)>12) //loop for each token
- {
- DecryptString(buff, inputstring, a_offset);
- }
- printf("%s\n", buff);
-
- int ch = getch();
- }
-