Login or Register for Dates, Times and to Reply

Thread Tools Search this Thread
Top Forums Programming zan
# 1  

Originally written by Don Yang -

Obfuscated code - this is as good as it gets and was a prize winner in the obfuscated code contest. Personally, I see obfuscated code every day written by cowboy programmers who worked developing our monstrous legacy system long ago.

This code rewrites itself into more C code. So, you get to compile & run it four times to see the output. The output is actual C code each time. All 4 compilations produce warnings.

This one is called zan.c You need to view each code file using fixed
width fonts like Courier to actually see what the code is doing. Proportional fonts distort it too much - IMO.

Hint: it produces characters embedded in the code, and if you're a fan of a certain genre of comic they will mean something to you.

"4e0!1r2e2!/t0"      "e4!-y-c6!+|,c6!)f$b(h*c6!(d'b(i)d5""!(b*a'`&c)c5!'b+`&b"
"'c)c4!&b-_$c'"      "d*c3!&a.h'd+d1!%a/g'e+e0!%b""-g("   "d.d/!&c*h'd1d-!(d%"
"g)d4d+!*l,d7d"       ")!,h-d;c""'!.b0c>d%!A`Dc$![7)3"      "5E!'1cA,,!2kE`*!"
"-s@d(!(k(f//g&"      "!)f.e5"     "'f(!+a+)""f%2g*!"        "?f5f,!=f-*e/!<d"
"6e1!9e0'f3!6f)"                  "-g5!4d*b+e6!0f%k"          ")d7!+~^'c7!)z/"
""                               "d-+!'n%a0(d5!%c1"          "a+/d4!2)c9""e2!"
"9"                             "b;e1!8b>e/!7cAd-"         "!5fAe+!7fBe(!8hBd"
"&!"          ":"        "iAd$![7S,"  "Q0!1bF7!1"        "b?'_6!1c,8b4!2b*a,*"
"d3!2n4f2!${4f.'!"       "%y4e5!&"      "f%d-^"        "-d7!4c+b)d9!4c-a'd:!/"
"i('`&d;!+l'a+d<!"       ")l*b(d=!'"     "m-a"        "&d>!&d'`0_&c?!$dAc@!$c"
"Bc@!$b<^&d$"             "`:!$""d9_"    "&l"        "++^$!%f3a'n1_$!&f/c(o/_"
"%!(f+c)"                "q*c"     "%!*f&d+"        "f$s&!-n,d)n(!0i-c-k)!3d/"
"b0h*!"                "H`7a,!"      "[7*i"        "]5471[=ohr&o*t*q*`*d*v*r;"
"027"                 "*~=h./}tc"     "rs"        "th&t:r9b].,b-725-.t--//#r["
"<t"        "8-7"    "52793?<.~;b]"   ".t"       "--+r/#537-r[/9~X.v90<6/<.v;"
""        "-52/={kgoh./}q;uvtohr`.i*$eng"       "t$$,b;$/=t;v;6=`it.`;7=`:,b-"
""       "725=/o`..d;b]`--[/+55/}o`.d:-?"       "5/}o`.'v/i]q--[;52=`it.o;53-"
""      ".v96<7/=o:d=o--/i]q--[;h"  "./"        ""    "=i]q--[;v9h./<-52={cju"
""        "c&`it.o;?4=o:d=o--/i]"   "q-"                "-[;54={""cjuc&i]"  ""
"q"          "--[;76=i]q[;6=v"     "sru"                  ".i/={=),BihY_"   ""
"gh"          "a,)",o[3217]       ;int i                   ,r,w,f,b,p,t=   641
,x;n()          {return r       <t?d[(*                     d+143+(r       ++)
)%t]:r>+          1341        ?59:(x=d[          (r                       ++-t
)%351+t])?x                  ^(p?6:0):(        p=+34);                  }main(
){w=sprintf(o,             "char""*d="       );r=p=0;for               (f=1;f<
*d+143;)if((b=d[f        ++])-33){if(b      <+93){if(!p)o[            w++]=34;
for(i=35+(p?0:1);i<b;i++)o[w++]=n();o[    w++]=p?n():+34;}else      for(i=92;i
<b;i++)o[w++]=32;}else o[w++]=10;o[w]=0;puts(o);};/*Don_Yang*/;;;;;;;;;;;;;;;;

# 2  
What does the code do? I compiled this on FreeBSD 4.6 and gcc 2.95.3 and it just printed itself (which is a terrific thing in itself, imo). But I didn't get that bit about compiling it 4 times. I'll try it on my Sol 10 box at work and get back later.
Login or Register for Dates, Times and to Reply

Previous Thread | Next Thread
Thread Tools Search this Thread
Search this Thread:
Advanced Search

Test Your Knowledge in Computers #31
Difficulty: Easy
Alan Turing was the founder of IBM.
True or False?

Featured Tech Videos