View Single Post
Mentor
13Mar2009,04:22  
xpi0t0s's Avatar
I can't figure out what it does. I've converted it to C and I think I've got it right but it just produces junk. There could be some nuance of Javascript I'm not aware of that means I've got the conversion wrong, which isn't unlikely as I'm not a Javascript expert, but I've tried a few things and nothing produces anything that looks meaningful.
Note that the Go4Expert parser will most likely add spaces to the long strings, as I think it has done with your original post. In this there are no spaces in x or t.
Also I've tweaked some of the code based on the actual length of x, e.g. as it's less than b, ceil(l/b) will be 1.
Code:
	char *x="yI02SkPLxf8LcWOLvVrJek02XqkkSkPz9Vw5xW2pyBO0h@BPGv70IBOzL@Blxmw2XV7zV_wkICkUTYwr6FBLhC2kRrq3y6w5XT0pRBp5Rnppr7kPomBLzPxUR@22S6qFcW80x8OzxWP2L6qP0_f3VF735RkJcw7zJOPJ27xlK7O0SW803nf39dY0XIP5zWOrvfflvWOxU@wr6nw0vC82cI2kxk02XBxrgrq0IBOzL@0rGGq";
	int t[]={63,25,62,40,29,60,55,10,30,32,0,0,0,0,0,0,3,0,31,23,16,36,54,50,8,51,44,53,5,6,21,28,14,47,4,58,49,39,57,35,7,48,27,13,0,0,0,0,18,0,5,2,52,22,17,26,41,33,20,12,43,45,19,6,24,46,11,42,9,1,37,38,15,59,34,61};
	int l=(int)strlen(x);
	int b=1024,i,j;
	int w=0,s=0,p=0;
	for (j=1/*ceil(l/b)*/; j>0; j--)
	{
		char r[1024];
		int rptr=0;
		r[rptr]=0;
		for (i=l; i>0; i--)
		{
			w|=(t[(x[p++]-48)])<<s;
			if(s)
			{
				r[rptr++]=char(149^w&255);
				r[rptr]=0;
				w>>=8;
				s-=2;
			}
			else{s=6;}
		}
		printf("eval('%s')\n",r);
	}