from time to time I amuse myself by writing little pieces of obfuscated code. it's probably not worthy of competition in an obfuscated code contest, but it's still fun. since they're all pretty small pieces of code, i've just pasted them right into this page. I encourage you to try to figure out what they do without reading my comments on them (which of course preceed them) or compiling them. But only if you enjoy torturing yourself in that manner.
a signature piece
I wrote this sometime during the fall of 1999, it just prints out my name and email address. it recursively calls itself in order to do so, using a static char* array that gets incremented every pass through the main function. this doesn't compile with c++ compilers because in c++ it is apparently illegal to recursively call main.
int main(int i){static char *p="\n=eok)bmgi[\\gX2d[YW_\\'\n\\SQO7\004HVF0"; char c;if(i<-33)return i+1;else{c=((i>0)?i[--p-i+1]:*(p++)); putchar(main(i-1)-((i>0)?0:i));return c;}}
a non-signature piece
I wrote this sometime in early february, 2000. although this code prints out my name and email address as usual, it is unsuitable as a signature, due to it's size. the size is bloated because you can only put one #define on a line, so since it was long but with lots of whitespace, i filled it up with bogus comment blocks. this one indexes into an array containing the encoded output string via another array of characters. It also contains no spaces other than ones within strings.
/**//**//**/#define/**/_S_/*http://prijks.esgeroth.org*/}/*(C)2000*//**/ /**//**//**//**//**//**//**//**//**/#define/**/_K_/**/putchar('2'-'('); #define/**/_I_/**/putchar(_3[_2[_5]-*(_2+4)]-((_2[_5]-60)%10));_l(_0); /**//**/#define/**/_R_/**/int/**/_5,_;for(_5=0;_5<5;_5++)/**//**//**/ #define/**/_0_/**/"\"""r"/**/"e""e""f""e"/**/"r""-""""m""a"/**/"n\""" """ #define/**/_4_/**/int/**/main(int/**/_0){static/**/char/**/*_2="CJLJ<"; #define/**/_J_/**/for/**/(_5=0;_5<27;_5++){_=_4[_5]-'F';putchar(_3[_]-_%10);} #define/**/_2_/**/static/**/char/**/*_3=" S>AnnqWx{@/irixzo";/**//**/ void/**/_l(int/**/_){switch(_){case/**/1:return;break;}printf(_0_);}/**/ _4_/**/_2_/**/static/**/char/**/*_4="GKJLUFHNOKJLUPTURTOSVWQSORI";/**/ /**//**//**//**//**/_R_/**/_I_/**/_J_/**/_K_/**/_S_/**//**//**//**//**/
a signature piece
this one was written sometime in mid february 2000. it prints out, depending on the number of command line arguments, my name and email address, my webpage url, or gibberish. it accomplishes this thru a very simplistic pseudo-random number generator that is seeded using argc.
char *s=":r\0tfnq<=-foiha\xA/,,aerrmprrr\x1D\x9heefph;cfqife\x1Dtsnhjq-QpM" "nmnn\0bidqf";unsigned int _(unsigned int _0){return((337*_0+113)%63);}int main(int a){unsigned int b=_(a);while(b[s]){putchar(s[b]+b%(a+2));b=_(b);}}