chongo@amdahl.uts.amdahl.com (Landon Curt Noll) (07/26/88)
# This is a shell archive. Remove anything before this line, then # unpack it by saving it in a file and typing "sh file". (Files # unpacked will be owned by you and have default permissions.) # # This archive contains: # # ./1984/Makefile ./1984/README ./1984/anonymous.c ./1984/anonymous.hint # ./1984/decot.c ./1984/decot.hint ./1984/laman.c ./1984/laman.hint # ./1984/mullender.c ./1984/mullender.hint ./1984/rules echo mkdir ./1984 mkdir ./1984 echo x - ./1984/Makefile sed -e 's/^X//' > "./1984/Makefile" << '//E*O*F ./1984/Makefile//' X# %W% %G% %U% X# X# 1984 makefile X XSHELL=/bin/sh XWINNERS=anonymous laman decot mullender X Xall: ${WINNERS} X Xanonymous: anonymous.c X cc $? -o $@ Xlaman: laman.c X cc $? -o $@ Xdecot: decot.c X cc $? -o $@ -lm Xmullender: mullender.c X cc $? -o $@ X Xclean: X rm -f core Xclobber: clean X rm -f ${WINNERS} X Xinstall: all X @echo are you kidding'??' //E*O*F ./1984/Makefile// echo x - ./1984/README sed -e 's/^X//' > "./1984/README" << '//E*O*F ./1984/README//' XIn 1984, the first contest was held. The name of the contest was simply X``Obfuscated C Code Contest''. X XRestrictions against machine dependent code were not in the rules in 1984. XThe source file size restriction was only 512 bytes. Rules and results Xwere posted to net.lang.c and net.unix-wizards. //E*O*F ./1984/README// echo x - ./1984/anonymous.c sed -e 's/^X//' > "./1984/anonymous.c" << '//E*O*F ./1984/anonymous.c//' Xint i;main(){for(;i["]<i;++i){--i;}"];read('-'-'-',i+++"hell\ Xo, world!\n",'/'/'/'));}read(j,i,p){write(j/p+p,i---j,i/i);} //E*O*F ./1984/anonymous.c// echo x - ./1984/anonymous.hint sed -e 's/^X//' > "./1984/anonymous.hint" << '//E*O*F ./1984/anonymous.hint//' XAnonymous entry: <?!?> Dishonorable mention X XThe author was too embarrassed that he/she could write such trash, so I Xpromised to protect their identity. I will say that the author of this Xprogram has a well known connection with the C programming language. X XThis program is a unique variation on the age old "Hello, world" Xprogram. What reads like a read may be written like a write! //E*O*F ./1984/anonymous.hint// echo x - ./1984/decot.c sed -e 's/^X//' > "./1984/decot.c" << '//E*O*F ./1984/decot.c//' X#define x = X#define double(a,b) int X#define char k['a'] X#define union static struct X Xextern int floor; Xdouble (x1, y1) b, Xchar x {sizeof( X double(%s,%D)(*)()) X,}; Xstruct tag{int x0,*xO;} X X*main(i, dup, signal) { X{ X for(signal=0;*k *x * __FILE__ *i;) do { X (printf(&*"'\",x); /*\n\\", (*((double(tag,u)(*)())&floor))(i))); X goto _0; X X_O: while (!(char <<x - dup)) { /*/*\*/ X union tag u x{4}; X } X} X X Xwhile(b x 3, i); { Xchar x b,i; X _0:if(b&&k+ X sin(signal) / * ((main) (b)-> xO));/*} X ; X} X X*/}}} //E*O*F ./1984/decot.c// echo x - ./1984/decot.hint sed -e 's/^X//' > "./1984/decot.hint" << '//E*O*F ./1984/decot.hint//' XSecond place award: <hpda!hpdsd!decot> Dave Decot X XCompile with: X X cc decot.c -o decot -lm X XNOTE: Some new compilers disliked line 15 of the source, so we changed it from: X X for(signal=0;*k * x * __FILE__ *i;) do { X Xto: X X for(signal=0;*k *x * __FILE__ *i;) do { X XThis program prints out a string of garbage. X XThe judges also offer this one comment: understand comments! //E*O*F ./1984/decot.hint// echo x - ./1984/laman.c sed -e 's/^X//' > "./1984/laman.c" << '//E*O*F ./1984/laman.c//' Xa[900]; b;c;d=1 ;e=1;f; g;h;O; main(k, Xl)char* *l;{g= atoi(* ++l); for(k= X0;k*k< g;b=k ++>>1) ;for(h= 0;h*h<= Xg;++h); --h;c=( (h+=g>h *(h+1)) -1)>>1; Xwhile(d <=g){ ++O;for (f=0;f< O&&d<=g X;++f)a[ b<<5|c] =d++,b+= e;for( f=0;f<O X&&d<=g; ++f)a[b <<5|c]= d++,c+= e;e= -e X;}for(c =0;c<h; ++c){ for(b=0 ;b<k;++ Xb){if(b <k/2)a[ b<<5|c] ^=a[(k -(b+1)) X<<5|c]^= a[b<<5 |c]^=a[ (k-(b+1 ))<<5|c] X;printf( a[b<<5|c ]?"%-4d" :" " ,a[b<<5 X|c]);} putchar( '\n');}} /*Mike Laman*/ //E*O*F ./1984/laman.c// echo x - ./1984/laman.hint sed -e 's/^X//' > "./1984/laman.hint" << '//E*O*F ./1984/laman.hint//' XThird place: <sdcsvax!laman> Mike Laman X XNOTE: Some new compilers dislike lines 6 and 10 of the source, so we changed Xthem from: X X;++f)a[ b<<5|c] =d++,b+ =e;for( f=0;f<O X<<5|c]^ =a[b<<5 |c]^=a[ (k-(b+1 ))<<5|c] X Xto: X X;++f)a[ b<<5|c] =d++,b+= e;for( f=0;f<O X<<5|c]^= a[b<<5 |c]^=a[ (k-(b+1 ))<<5|c] X XI hope you have the C beautifier! The program accepts ONE positive Xargument. Seeing is believing, so try things like: X X laman 4 X laman 9 X laman 16 X XThis code should run you in circles. //E*O*F ./1984/laman.hint// echo x - ./1984/mullender.c sed -e 's/^X//' > "./1984/mullender.c" << '//E*O*F ./1984/mullender.c//' Xshort main[] = { X 277, 04735, -4129, 25, 0, 477, 1019, 0xbef, 0, 12800, X -113, 21119, 0x52d7, -1006, -7151, 0, 0x4bc, 020004, X 14880, 10541, 2056, 04010, 4548, 3044, -6716, 0x9, X 4407, 6, 5568, 1, -30460, 0, 0x9, 5570, 512, -30419, X 0x7e82, 0760, 6, 0, 4, 02400, 15, 0, 4, 1280, 4, 0, X 4, 0, 0, 0, 0x8, 0, 4, 0, ',', 0, 12, 0, 4, 0, '#', X 0, 020, 0, 4, 0, 30, 0, 026, 0, 0x6176, 120, 25712, X 'p', 072163, 'r', 29303, 29801, 'e' X}; //E*O*F ./1984/mullender.c// echo x - ./1984/mullender.hint sed -e 's/^X//' > "./1984/mullender.hint" << '//E*O*F ./1984/mullender.hint//' XThe Grand Prize: <vu44!{sjoerd,cogito}> Sjoerd Mullender & Robbert van Renesse X XWithout question, this C program is the most obfuscated C program that Xhas ever been received! Like all great contest entries, they result Xin a change of rules for the following year. To prevent a flood of Xsimilar programs, we requested that programs be non machine specific. X XThis program was selected for the 1987 t-shirt collection. X XNOTE: If your machine is not a Vax-11 or pdp-11, this program will X not execute correctly. In later years, machine dependent X code was discouraged. X XThe C startup routine (via crt0.o) transfers control to a location Xnamed main. In this case, main just happens to be in the data area. XThe array of shorts, which has been further obfuscated by use of Xdifferent data types, just happens to form a meaningful set of PDP-11 Xand Vax instructions. The first word is a PDP-11 branch instruction Xthat branches to the rest of the PDP code. On the Vax main is called with Xthe calls instruction which uses the first word of the subroutine as a Xmask of registers to be saved. So on the Vax the first word can be anything. XThe real Vax code starts with the second word. This small program Xmakes direct calls to the write() Unix system call to produce a Xmessage on the screen. Can you guess what is printed? We knew you Xcouldn't! :-) //E*O*F ./1984/mullender.hint// echo x - ./1984/rules sed -e 's/^X//' > "./1984/rules" << '//E*O*F ./1984/rules//' XI'm sure you have all seen gross, or down right structurally obscene C Xsource code before. Some people who deal with various parts of the XUN*X source wonder if some folks try rather hard to produce such Xdown right smelly code. X XNow you have the chance to compete with the worst C hackers around Xby sending in your own obfuscated C program. Just follow the contest Xrules below: X 1) the source file must be no more than 512 bytes long X X 2) mail your source to: hplabs!nsc!chongo X no later than April 11, 1984. entries posted to X the net will NOT be accepted. please give your X letter the subject of: obfuscated C code contest. X X 3) winning entries will be posted to net.lang.c after X April 12, 1894. (thats the prize folks) X X 4) indicate your net address in the text of your X entry, this will be used to give credit unless X you indicate that you want to remain anonymous. X X 5) entries must be of original work. (dont send anything X that might upset Big Brother Bell) all entries are X public domain. (who would want to own them anyway?!) X XEntries will be judged for: violations of structured programming, non-clarity, Xand use of "by the K&R book" C. (use of local mods to C are not encouraged) Xextra credit if they can be compiled using the 4.2BSD C compiler on our VAX 780, Xbut dont let the lack of a 780 or 4.2 discourage you! X Xchongo <flames about the contest will be kindly #ifdef'ed out> /\CC/\ X XUN*X is a trademark of Usenet Hackers Anonymous X XWARNING: The rules and mailing address for the contest change from year X to year. Be sure that you consult the current set of rules X before submitting entries. //E*O*F ./1984/rules// echo Possible errors detected by \'wc\' [hopefully none]: temp=/tmp/shar$$ trap "rm -f $temp; exit" 0 1 2 3 15 cat > $temp <<\!!! 25 55 331 Makefile 6 48 300 README 2 4 123 anonymous.c 8 66 386 anonymous.hint 32 77 509 decot.c 17 61 372 decot.hint 12 62 510 laman.c 21 76 499 laman.hint 10 86 431 mullender.c 25 234 1357 mullender.hint 38 284 1666 rules 196 1053 6484 total !!! wc ./1984/Makefile ./1984/README ./1984/anonymous.c ./1984/anonymous.hint ./1984/decot.c ./1984/decot.hint ./1984/laman.c ./1984/laman.hint ./1984/mullender.c ./1984/mullender.hint ./1984/rules | sed 's=[^ ]*/==' | diff -b $temp - exit 0 -- [views above shouldn't be viewed as Amdahl views, or as views from Amdahl, or as Amdahl views views, or as views by Mr. Amdahl, or as views from his house]
chongo@amdahl.uts.amdahl.com (Landon Curt Noll) (07/26/88)
# This is a shell archive. Remove anything before this line, then # unpack it by saving it in a file and typing "sh file". (Files # unpacked will be owned by you and have default permissions.) # # This archive contains: # # ./1985/Makefile ./1985/README ./1985/applin.c ./1985/applin.hint # ./1985/august.c ./1985/august.hint ./1985/lycklama.c # ./1985/lycklama.hint ./1985/rules ./1985/shapiro.c ./1985/shapiro.hint # ./1985/sicherman.c ./1985/sicherman.hint echo mkdir ./1985 mkdir ./1985 echo x - ./1985/Makefile sed -e 's/^X//' > "./1985/Makefile" << '//E*O*F ./1985/Makefile//' X# %W% %G% %U% X# X# 1985 makefile X XSHELL=/bin/sh XWINNERS= applin august lycklama shapiro sicherman X Xall: ${WINNERS} X Xapplin: applin.c X cc $? -o $@ Xaugust: august.c X cc $? -o $@ Xlycklama: lycklama.c X cc $? -o $@ Xshaprio: shaprio.c X cc $? -o $@ Xscherman: sicherman.c X cc $? -o $@ X Xclean: X rm -f core Xclobber: clean X rm -f ${WINNERS} X Xinstall: all X @echo are you kidding'??' //E*O*F ./1985/Makefile// echo x - ./1985/README sed -e 's/^X//' > "./1985/README" << '//E*O*F ./1985/README//' XIn 1985, the second Obfuscated C Code Contest was held. Hints against Xmachine dependent code were added to the rules to avoid another 1984 Xstyle winner. Rules and results were posted to net.lang.c and Xnet.unix-wizards. Larry Bassel was invited to help in the judging. XAwards were given to 5 classes of programs since we were unable to Xselect only the best 4. //E*O*F ./1985/README// echo x - ./1985/applin.c sed -e 's/^X//' > "./1985/applin.c" << '//E*O*F ./1985/applin.c//' Xmain(v,c)char**c;{for(v[c++]="Hello, world!\n)";(!!c)[*c]&&(v--||--c&&execlp(*c,*c,c[!!c]+!!c,!c));**c=!c)write(!!*c,*c,!!**c);} //E*O*F ./1985/applin.c// echo x - ./1985/applin.hint sed -e 's/^X//' > "./1985/applin.hint" << '//E*O*F ./1985/applin.hint//' XBest one liner: <hp-dcd!jack> Jack Applin [with help from Robert Heckendorn] X XOne liner programs are short but twisted. This "Hello, World" version Xcertainly takes its time saying hello. //E*O*F ./1985/applin.hint// echo x - ./1985/august.c sed -e 's/^X//' > "./1985/august.c" << '//E*O*F ./1985/august.c//' X#define p struct c X#define q struct b X#define h a->a X#define i a->b X#define e i->c X#define o a=(*b->a)(b->b,b->c) X#define s return a;}q* X#define n (d,b)p*b;{q*a;p*c; X#define z(t)(t*)malloc(sizeof(t)) Xq{int a;p{q*(*a)();int b;p*c;}*b;};q*u n a=z(q);h=d;i=z(p);i->a=u;i->b=d+1;s Xv n c=b;do o,b=i;while(!(h%d));i=c;i->a=v;i->b=d;e=b;s Xw n o;c=i;i=b;i->a=w;e=z(p);e->a=v;e->b=h;e->c=c;s Xt n for(;;)o,main(-h),b=i;}main(b){p*a;if(b>0)a=z(p),h=w,a->c=z(p),a->c->a=u, Xa->c->b=2,t(0,a);putchar(b?main(b/2),-b%2+'0':10);} //E*O*F ./1985/august.c// echo x - ./1985/august.hint sed -e 's/^X//' > "./1985/august.hint" << '//E*O*F ./1985/august.hint//' XThe most obscure program<chalmers!augustss>: Lennart Augustsson X XAn interesting use of a recursive call to main. Compile and execute Xwithout args. What is the initial value of b, and does it alter the Xaction of the program? X XIf you let it, the program will continue to print a numerical sequence X(can you guess in what base it is printed?) until you run out of Xmemory or until they sell your computer, which ever comes first. //E*O*F ./1985/august.hint// echo x - ./1985/lycklama.c sed -e 's/^X//' > "./1985/lycklama.c" << '//E*O*F ./1985/lycklama.c//' X#define o define X#o ___o write X#o ooo (unsigned) X#o o_o_ 1 X#o _o_ char X#o _oo goto X#o _oo_ read X#o o_o for X#o o_ main X#o o__ if X#o oo_ 0 X#o _o(_,__,___)(void)___o(_,__,ooo(___)) X#o __o (o_o_<<((o_o_<<(o_o_<<o_o_))+(o_o_<<o_o_)))+(o_o_<<(o_o_<<(o_o_<<o_o_))) Xo_(){_o_ _=oo_,__,___,____[__o];_oo ______;_____:___=__o-o_o_; _______: X_o(o_o_,____,__=(_-o_o_<___?_-o_o_:___));o_o(;__;_o(o_o_,"\b",o_o_),__--); X_o(o_o_," ",o_o_);o__(--___)_oo _______;_o(o_o_,"\n",o_o_);______:o__(_=_oo_( Xoo_,____,__o))_oo _____;} //E*O*F ./1985/lycklama.c// echo x - ./1985/lycklama.hint sed -e 's/^X//' > "./1985/lycklama.hint" << '//E*O*F ./1985/lycklama.hint//' XThe strangest appearing program: <ism780!ed> Ed Lycklama X XRun the program without any arguments. Type in some very long lines Xand notice how it redisplays it. X XThe program itself looks like tty noise. Notice that even `define' in X#define can be defined. //E*O*F ./1985/lycklama.hint// echo x - ./1985/rules sed -e 's/^X//' > "./1985/rules" << '//E*O*F ./1985/rules//' XWARNING: The rules and mailing address for the contest change from year X to year. Be sure that you consult the current set of rules X before submitting entries. X-------------------------------------------------------------------------------- X XIt is time once again for the net wide Obfuscated C code contest! X XGOAL: To write the most Obscure working C program under the rules below: X XRULES: 1) The source must be 512 bytes or less. X 2) Mail your entries to: ...!ihnp4!nsc!chongo X Postings to the net will NOT be used! X 3) Include at the top of the letter: X a) Your name, and path from a major network node. X If you want your entry to be anonymous, indicate this as well. X b) A brief statement of what the program should do. X c) The machine/opsys on which it runs. X 4) Enclose your source between the following lines: X---start of program--- X<place obfuscated source here> X---end of program--- X 5) The C program must be written in common C. X That is, K&R plus common extensions (say 4.2 or Sys V C) X 6) The program must be of original work. X 7) The program must be a complete program. (i.e., not just a fragment) X 8) Entries must be received by me on or before June 8, 1985. X XPOINTS: Each entry will be judged for its non-clarity. I will attempt to X run each of them on a Vax 780/4.2BSD system. Don't let the lack X of such a system stop you! Try to avoid operating system/machine X specific code if you do not have such a system. Extra points will X be given for program that: X X a) Able to pass lint without complaint X b) Actually does something interesting (not just exit) X c) are portable (i.e., no special calls of local features) X (long variable names will be allowed as needed) X XThe names of the winners will be posted to net.lang.c. The winning Xsources will be posted to net.sources. X XIf you have any questions on the rules/points above, just ask via mail! X Xchongo <main(){int i;i+=i+++++i;exit(i);}> /\??/\ //E*O*F ./1985/rules// echo x - ./1985/shapiro.c sed -e 's/^X//' > "./1985/shapiro.c" << '//E*O*F ./1985/shapiro.c//' X#define P(X)j=write(1,X,1) X#define C 39 Xint M[5000]={2},*u=M,N[5000],R=22,a[4],l[]={0,-1,C-1,-1},m[]={1,-C,-1,C},*b=N, X*d=N,c,e,f,g,i,j,k,s;main(){for(M[i=C*R-1]=24;f|d>=b;){c=M[g=i];i=e;for(s=f=0; Xs<4;s++)if((k=m[s]+g)>=0&&k<C*R&&l[s]!=k%C&&(!M[k]||!j&&c>=16!=M[k]>=16))a[f++ X]=s;if(f){f=M[e=m[s=a[rand()/(1+2147483647/f)]]+g];j=j<f?f:j;f+=c&-16*!j;M[g]= Xc|1<<s;M[*d++=e]=f|1<<(s+2)%4;}else e=d>b++?b[-1]:e;}P(" ");for(s=C;--s;P("_") X)P(" ");for(;P("\n"),R--;P("|"))for(e=C;e--;P("_ "+(*u++/8)%2))P("| "+(*u/4)%2 X);} //E*O*F ./1985/shapiro.c// echo x - ./1985/shapiro.hint sed -e 's/^X//' > "./1985/shapiro.hint" << '//E*O*F ./1985/shapiro.hint//' XGrand prize for most well-rounded in confusion: <otto!carl> Carl Shapiro X XAs submitted, this program was 3 lines (2 of defines and 1 of code). XTo make news & mail happy we split the last line into 7. Join them Xback without the newlines to get the original version. X XThis program was selected for the 1987 t-shirt collection. X XWe found this program is be simply aMAZEing! Run this program without Xarguments and notice the output. //E*O*F ./1985/shapiro.hint// echo x - ./1985/sicherman.c sed -e 's/^X//' > "./1985/sicherman.c" << '//E*O*F ./1985/sicherman.c//' X#define C_C_(_)~' '&_ X#define _C_C(_)('\b'b'\b'>=C_C>'\t'b'\n') X#define C_C _|_ X#define b * X#define C /b/ X#define V _C_C( Xmain(C,V) Xchar **V; X/* C program. (If you don't X * understand it look it X */ up.) (In the C Manual) X{ X char _,__; X while (read(0,&__,1) & write((_=(_=C_C_(__),C)), X _C_,1)) _=C-V+subr(&V); X} Xsubr(C) Xchar *C; X{ X C="Lint says "argument Manual isn't used." What's that X mean?"; while (write((read(C_C('"'-'/*"'/*"*/))?__:__-_+ X '\b'b'\b'|((_-52)%('\b'b'\b'+C_C_('\t'b'\n'))+1),1),&_,1)); X} //E*O*F ./1985/sicherman.c// echo x - ./1985/sicherman.hint sed -e 's/^X//' > "./1985/sicherman.hint" << '//E*O*F ./1985/sicherman.hint//' XThe worst abuse of the C preprocessor: <sunybcs!colonel> Col. G. L. Sicherman X XThis program abuses the C preprocessor so much that some /lib/cpp's fail to Xstrip out all of the comments on the first pass! If you were able to Xunderstand Decot's entry in 1984, you will have a head start on this Xone. X XBe sure to run this program through lint! If your lint works Xcorrectly, it should warn you that the argument `Manual' isn't used. XLike the program says, what's that mean? X XRun the program without arguments and enter the letters 'a' thru 'm' Xon a line. Now enter the letters 'n' thru 'z'. But to borrow a quote Xfrom Richard Stallman: If you think you understand what this code Xdoes, then you don't, so read it again! Explain why: X X sicherman < sicherman.c | sicherman | diff - sicherman.c X Xresults in diff reporting a difference on some machines. //E*O*F ./1985/sicherman.hint// echo Possible errors detected by \'wc\' [hopefully none]: temp=/tmp/shar$$ trap "rm -f $temp; exit" 0 1 2 3 15 cat > $temp <<\!!! 27 62 370 Makefile 6 62 362 README 1 2 129 applin.c 4 28 188 applin.hint 14 45 513 august.c 9 74 428 august.hint 17 48 509 lycklama.c 7 41 256 lycklama.hint 44 322 1958 rules 9 18 518 shapiro.c 10 74 430 shapiro.hint 23 64 511 sicherman.c 19 150 850 sicherman.hint 190 990 7022 total !!! wc ./1985/Makefile ./1985/README ./1985/applin.c ./1985/applin.hint ./1985/august.c ./1985/august.hint ./1985/lycklama.c ./1985/lycklama.hint ./1985/rules ./1985/shapiro.c ./1985/shapiro.hint ./1985/sicherman.c ./1985/sicherman.hint | sed 's=[^ ]*/==' | diff -b $temp - exit 0 -- [views above shouldn't be viewed as Amdahl views, or as views from Amdahl, or as Amdahl views views, or as views by Mr. Amdahl, or as views from his house]
chongo@amdahl.uts.amdahl.com (Landon Curt Noll) (07/26/88)
# This is a shell archive. Remove anything before this line, then # unpack it by saving it in a file and typing "sh file". (Files # unpacked will be owned by you and have default permissions.) # # This archive contains: # # ./1986/Makefile ./1986/README ./1986/applin.c ./1986/applin.hint # ./1986/august.c ./1986/august.hint ./1986/bright.c ./1986/bright.hint # ./1986/hague.c ./1986/hague.hint ./1986/holloway.c ./1986/holloway.hint # ./1986/marshall.c ./1986/marshall.hint ./1986/pawka.c ./1986/pawka.hint # ./1986/rules ./1986/stein.c ./1986/stein.hint ./1986/wall.c # ./1986/wall.hint echo mkdir ./1986 mkdir ./1986 echo x - ./1986/Makefile sed -e 's/^X//' > "./1986/Makefile" << '//E*O*F ./1986/Makefile//' X# %W% %G% %U% X# X# 1986 makefile X XSHELL=/bin/sh XWINNERS=marshall hague applin bright stein holloway august pawka wall X Xall: ${WINNERS} X Xmarshall: marshall.c X cc $? -o $@ Xhague: hague.c X cc $? -o $@ Xapplin: applin.c X cc $? -o $@ Xbright: bright.c X cc $? -o $@ Xstein: stein.c X -rm -f a.out X cc $? -o $@ X -ln $@ a.out Xholloway: holloway.c X cc $? -o $@ Xaugust: august.c X cc $? -o $@ Xpawka: pawka.c X cc $? -o $@ Xwall: wall.c X cc $? -o $@ X Xclean: X rm -f core Xclobber: clean X rm -f ${WINNERS} a.out Xinstall: all X @echo are you kidding'??' //E*O*F ./1986/Makefile// echo x - ./1986/README sed -e 's/^X//' > "./1986/README" << '//E*O*F ./1986/README//' XThe 1986 contest was named: "The Third International Obfuscated C Code Contest" X XThe rules for 1986 suggested categories due to the success of the 1985 Xjudging method. The maximum size was increased from 512 to 1024 bytes. XLarry Bassel joined as the second official judge. X XA poll was taken for the worst code for BSD and System V program. XThe Bourne Shell (/bin/sh) won for both systems. The BSD finger Xprogram took third place. X XRules and results were posted to net.lang.c and net.unix-wizards. XMicro/Systems Journal published started regular publishing of the winners. XThe practice of making first announcement of the winners at the Summer XUsenix BOF started this year. A notice was posted to net.announce. X //E*O*F ./1986/README// echo x - ./1986/applin.c sed -e 's/^X//' > "./1986/applin.c" << '//E*O*F ./1986/applin.c//' Xcat =13 /*/ >/dev/null 2>&1; echo "Hello, world!"; exit X* X* This program works under cc, f77, and /bin/sh. X* X*/; main() { X write( Xcat-~-cat X /*,'( X*/ X ,"Hello, world!" X , Xcat); putchar(~-~-~-cat); } /* X ,)') X end X*/ //E*O*F ./1986/applin.c// echo x - ./1986/applin.hint sed -e 's/^X//' > "./1986/applin.hint" << '//E*O*F ./1986/applin.hint//' XMost adaptable program: <hpfcdc!jack> Jack Applin X X Jack Applin X Hewlett-Packard X Ft. Collins X Colorado X USA X XCompile and/or execute as directed by the documentation. X XThe judges were so amused by this little program that we created an Xaward just for it. This program is portable to the C and Fortran 77 Xcompilers as well as executable by the bourne shell! //E*O*F ./1986/applin.hint// echo x - ./1986/august.c sed -e 's/^X//' > "./1986/august.c" << '//E*O*F ./1986/august.c//' Xtypedef struct n{int a:3, Xb:29;struct n*c;}t;t* Xf();r(){}m(u)t*u;{t*w,*z; Xz=u->c,q(z),u->b=z->b*10, Xw=u->c=f(),w->a=1,w->c=z-> Xc;}t*k;g(u)t*u;{t*z,*v,*p, X*x;z=u->c,q(z),u->b=z->b,v X=z->c,z->a=2,x=z->c=f(),x X->a=3,x->b=2,p=x->c=f(),p X->c=f(),p->c->a=1,p->c->c= Xv;}int i;h(u)t*u;{t*z,*v,* Xw;int c,e;z=u->c,v=z->c,q( Xv),c=u->b,e=v->b,u->b=z->b X,z->a=3,z->b=c+1,e+9>=c&&( Xq(z),e=z->b,u->b+=e/c,w=f( X),w->b=e%c,w->c=z->c,u->c= Xw);}int(*y[4])()={r,m,g,h}; Xchar *sbrk();main(){t*e,*p,*o; Xo=f(),o->c=o,o->b=1,e=f(), Xe->a=2,p=e->c=f(),p->b=2, Xp->c=o,q(e),e=e->c,(void)write X(1,"2.",2);for(;;e=e->c){q(e), Xe->b=write(1,&e->b["0123456789"], X1);}}t*f(){return i||(i=1000, Xk=(t*)sbrk(i*sizeof(t))),k+--i; X}q(p)t*p;{(*y[p->a])(p);} //E*O*F ./1986/august.c// echo x - ./1986/august.hint sed -e 's/^X//' > "./1986/august.hint" << '//E*O*F ./1986/august.hint//' XBest complex task done in a complex way: <augustss@chalmers> Lennart Augustsson X X Lennart Augustsson X Dept. of Comp. Sci. X Chalmers University of Technology, X 412 96 Gothenburg X Sweden X XThis program computes a specific mathematical value. Simply compile Xand give it an infinite amount of stack space and cpu time. Otherwise Xjust be satisfied with the approximation displayed just before the core Xdump. X XThis program will pass lint on your system assuming your lint is brave Xenough to try and parse it correctly. //E*O*F ./1986/august.hint// echo x - ./1986/bright.c sed -e 's/^X//' > "./1986/bright.c" << '//E*O*F ./1986/bright.c//' X#include <stdio.h> X#define O1O printf X#define OlO putchar X#define O10 exit X#define Ol0 strlen X#define QLQ fopen X#define OlQ fgetc X#define O1Q abs X#define QO0 for Xtypedef char lOL; X XlOL*QI[] = {"Use:\012\011dump file\012","Unable to open file '\x25s'\012", X "\012"," ",""}; X Xmain(I,Il) XlOL*Il[]; X{ FILE *L; X unsigned lO; X int Q,OL[' '^'0'],llO = EOF, X X O=1,l=0,lll=O+O+O+l,OQ=056; X lOL*llL="%2x "; X (I != 1<<1&&(O1O(QI[0]),O10(1011-1010))), X ((L = QLQ(Il[O],"r"))==0&&(O1O(QI[O],Il[O]),O10(O))); X lO = I-(O<<l<<O); X while (L-l,1) X { QO0(Q = 0L;((Q &~(0x10-O))== l); X OL[Q++] = OlQ(L)); X if (OL[0]==llO) break; X O1O("\0454x: ",lO); X if (I == (1<<1)) X { QO0(Q=Ol0(QI[O<<O<<1]);Q<Ol0(QI[0]); X Q++)O1O((OL[Q]!=llO)?llL:QI[lll],OL[Q]);/*" X O10(QI[1O])*/ X O1O(QI[lll]);{} X } X QO0 (Q=0L;Q<1<<1<<1<<1<<1;Q+=Q<0100) X { (OL[Q]!=llO)? /* 0010 10lOQ 000LQL */ X ((D(OL[Q])==0&&(*(OL+O1Q(Q-l))=OQ)), X OlO(OL[Q])): X OlO(1<<(1<<1<<1)<<1); X } X O1O(QI[01^10^9]); X lO+=Q+0+l;} X } X D(l) { return l>=' '&&l<='\~'; X} //E*O*F ./1986/bright.c// echo x - ./1986/bright.hint sed -e 's/^X//' > "./1986/bright.hint" << '//E*O*F ./1986/bright.hint//' XMost useful obfuscation: <dataio!bright> Walter Bright X XCompile this program and give filenames as arguments. For example try: X X bright bright.c X bright bright X XMr. Bright exploits the c pre-processor, similar variables and Xexcessive shifting to obfuscate an otherwise useful binary display Xprogram. This gives you a small example of what it is like to Xmaintain the Bourne shell! :-} //E*O*F ./1986/bright.hint// echo x - ./1986/hague.c sed -e 's/^X//' > "./1986/hague.c" << '//E*O*F ./1986/hague.c//' X#define DIT ( X#define DAH ) X#define __DAH ++ X#define DITDAH * X#define DAHDIT for X#define DIT_DAH malloc X#define DAH_DIT gets X#define _DAHDIT char X_DAHDIT _DAH_[]="ETIANMSURWDKGOHVFaLaPJBXCYZQb54a3d2f16g7c8a90l?e'b.s;i,d:" X;main DIT DAH{_DAHDIT XDITDAH _DIT,DITDAH DAH_,DITDAH DIT_, XDITDAH _DIT_,DITDAH DIT_DAH DIT XDAH,DITDAH DAH_DIT DIT DAH;DAHDIT XDIT _DIT=DIT_DAH DIT 81 DAH,DIT_=_DIT X__DAH;_DIT==DAH_DIT DIT _DIT DAH;__DIT XDIT'\n'DAH DAH DAHDIT DIT DAH_=_DIT;DITDAH XDAH_;__DIT DIT DITDAH X_DIT_?_DAH DIT DITDAH DIT_ DAH:'?'DAH,__DIT XDIT' 'DAH,DAH_ __DAH DAH DAHDIT DIT XDITDAH DIT_=2,_DIT_=_DAH_; DITDAH _DIT_&&DIT XDITDAH _DIT_!=DIT DITDAH DAH_>='a'? DITDAH XDAH_&223:DITDAH DAH_ DAH DAH; DIT XDITDAH DIT_ DAH __DAH,_DIT_ __DAH DAH XDITDAH DIT_+= DIT DITDAH _DIT_>='a'? DITDAH _DIT_-'a':0 XDAH;}_DAH DIT DIT_ DAH{ __DIT DIT XDIT_>3?_DAH DIT DIT_>>1 DAH:'\0'DAH;return XDIT_&1?'-':'.';}__DIT DIT DIT_ DAH _DAHDIT XDIT_;{DIT void DAH write DIT 1,&DIT_,1 DAH;} //E*O*F ./1986/hague.c// echo x - ./1986/hague.hint sed -e 's/^X//' > "./1986/hague.hint" << '//E*O*F ./1986/hague.hint//' XWorst abuse of the C preprocessor: <ukc!jmh> Jim Hague X X Jim Hague X University of Kent at Canterbury X Canterbury, Kent X UK X XCompile this program and feed ascii text into standard input. This Xprogram is known to pass lint on some systems and abort lint on Xothers. X XThis program was selected for the 1987 t-shirt collection. X XThink morse code when you ponder this program. Note how use of Xsimilar variables can be obfuscating! The author notes that this Xprogram implements the international morse standard. Now for extra Xcredit, what morse message does the program spell out? //E*O*F ./1986/hague.hint// echo x - ./1986/holloway.c sed -e 's/^X//' > "./1986/holloway.c" << '//E*O*F ./1986/holloway.c//' X#include "stdio.h" X#define e 3 X#define g (e/e) X#define h ((g+e)/2) X#define f (e-g-h) X#define j (e*e-g) X#define k (j-h) X#define l(x) tab2[x]/h X#define m(n,a) ((n&(a))==(a)) X Xlong tab1[]={ 989L,5L,26L,0L,88319L,123L,0L,9367L }; Xint tab2[]={ 4,6,10,14,22,26,34,38,46,58,62,74,82,86 }; X Xmain(m1,s) char *s; { X int a,b,c,d,o[k],n=(int)s; X if(m1==1){ char b[2*j+f-g]; main(l(h+e)+h+e,b); printf(b); } X else switch(m1-=h){ X case f: X a=(b=(c=(d=g)<<g)<<g)<<g; X return(m(n,a|c)|m(n,b)|m(n,a|d)|m(n,c|d)); X case h: X for(a=f;a<j;++a)if(tab1[a]&&!(tab1[a]%((long)l(n))))return(a); X case g: X if(n<h)return(g); X if(n<j){n-=g;c='D';o[f]=h;o[g]=f;} X else{c='\r'-'\b';n-=j-g;o[f]=o[g]=g;} X if((b=n)>=e)for(b=g<<g;b<n;++b)o[b]=o[b-h]+o[b-g]+c; X return(o[b-g]%n+k-h); X default: X if(m1-=e) main(m1-g+e+h,s+g); else *(s+g)=f; X for(*s=a=f;a<e;) *s=(*s<<e)|main(h+a++,(char *)m1); X } X} //E*O*F ./1986/holloway.c// echo x - ./1986/holloway.hint sed -e 's/^X//' > "./1986/holloway.hint" << '//E*O*F ./1986/holloway.hint//' XBest simple task performed in a complex way: <drivax!holloway> Bruce Holloway X X Bruce Holloway X Digital Research, Inc. X Monterey, CA X USA X XBelieve it or not, this is the old standard "Hello, world" program Xperformed in a very complex way. The judges and the author defy you Xdo determine how it does it. It is a good thing that K&R didn't use Xthis version as the first C program! //E*O*F ./1986/holloway.hint// echo x - ./1986/marshall.c sed -e 's/^X//' > "./1986/marshall.c" << '//E*O*F ./1986/marshall.c//' X extern int X errno X ;char X grrr X ;main( r, X argv, argc ) int argc , X r ; char *argv[];{int P( ); X#define x int i, j,cc[4];printf(" choo choo\n" ) ; Xx ;if (P( ! i ) | cc[ ! j ] X& P(j )>2 ? j : i ){* argv[i++ +!-i] X; for (i= 0;; i++ ); X_exit(argv[argc- 2 / cc[1*argc]|-1<<4 ] ) ;printf("%d",P(""));}} X P ( a ) char a ; { a ; while( a > " B " X /* - by E ricM arsh all- */); } //E*O*F ./1986/marshall.c// echo x - ./1986/marshall.hint sed -e 's/^X//' > "./1986/marshall.hint" << '//E*O*F ./1986/marshall.hint//' XBest layout: <burdvax!eric> Eric Marshall X X Eric Marshall X System Development Corporation, a Burroughs Company X P.O. Box 517 X Paoli, PA. X 19301 X XThis program prints the name of the picture. The layout is somewhat Xpretty through it is not the usual sort of output one would expect Xfrom printing a program! X XThis program was slected for the 1987 t-shirt collection. X XThis program is known to give some C compilers a problems. //E*O*F ./1986/marshall.hint// echo x - ./1986/pawka.c sed -e 's/^X//' > "./1986/pawka.c" << '//E*O*F ./1986/pawka.c//' X#include "stdio.h" X#define xyxx char X#define xyyxx putchar X#define xyyyxx while X#define xxyyyx int X#define xxxyyx main X#define xyxyxy if X#define xyyxyy '\n' Xxyxx *xyx [] = { X"]I^x[I]k\\I^o[IZ~\\IZ~[I^|[I^l[I^j[I^}[I^n[I]m\\I]h", X"]IZx\\IZx[IZk\\IZk[IZo_IZ~\\IZ~[IZ|_IZl_IZj\\IZj]IZ}]IZn_IZm\\IZm_IZh", X"]IZx\\IZx[I^k[I\\o]IZ~\\IZ~\\I]|[IZl_I^j]IZ}]I^n[IZm\\IZm_IZh", X"]IZx\\IZx[IZk\\IZk[IZo_IZ~\\IZ~_IZ|[IZl_IZj\\IZj]IZ}]IZn_IZm\\IZm]IZh", X"]I^x[I]k\\IZo_I^~[I^|[I^l[IZj\\IZj]IZ}]I^n[I]m^IZh",'\0'};/*xyyxyxyxxxyxxxyy*/ Xxyxx *xyyx; xxyyyx xyyyx,xyyyyx,xyyyyyx=0x59,xyyyyyyx=0x29,/*yxxyxyyyxxyyyxyy*/ Xxxyx=0x68;xxxyyx(){xyyyyx=0;xyyyxx(xyx[xyyyyx]){xyyx=xyx[xyyyyx++];/*xyyyxxyx*/ Xxyyyxx(*xyyx){xyyyx= *xyyx++-xyyyyyx;xyyyxx(xyyyx--)xyyxx(*xyyx-xyyyyyyx);/*x*/ Xxyxyxy(*xyyx==xxyx)xyyxx(xyyxyy);*xyyx++;}}}/*xyxyxyyyyxxyxxxyyyxyyyxyxxyyy*/ //E*O*F ./1986/pawka.c// echo x - ./1986/pawka.hint sed -e 's/^X//' > "./1986/pawka.hint" << '//E*O*F ./1986/pawka.hint//' XMost illegible code: <PAWKA@NOSC-TECR.ARPA> Michael H. Pawka X X Michael H. Pawka X Naval Ocean Systems Center X San Diego, Ca X 92152 X XThe judges found this entry to be one of hardest to read without the Xaid of /lib/cpp and a good editor. When run, the program asks if it Xis obfuscated, of all things! //E*O*F ./1986/pawka.hint// echo x - ./1986/rules sed -e 's/^X//' > "./1986/rules" << '//E*O*F ./1986/rules//' XWARNING: The rules and mailing address for the contest change from year X to year. Be sure that you consult the current set of rules X before submitting entries. X------------------------------------------------------------------------------- X XSubject: Third International Obfuscated C Code Contest Rules XNewsgroups: net.lang.c XKeywords: rules,1986,obfuscate,contest X XGOAL: To write the most Obscure working C program following the rules below: X XRULES: 1) The source must be 1024 bytes or less. NO exceptions! X X 2) Include in your letter: X a) Name (or anonymous), Company/School, City, State and Country. X b) Your path from a major network site, if applicable. X c) A brief statement of what the program should do. X d) The Machine(s)/Operating system(s) on which it runs. X e) Enclose your source between the following lines: X ---start of program--- X <place obfuscated source of 1024 bytes or less here> X ---end of program--- X X 3) The entry should be written in common C. (K&R + common extensions) X X 4) The program must be of original work. All programs must be X in the public domain. All copyrighted programs will be rejected. X X 5) Entries must be received between 31-Mar-86 and 30-May-86 0:00 GMT. X Email your entries to: X X decwrl!nsc!obfuscate X X Entries sent by UUCP Email will be confirmed starting 1-May-86. X People are encouraged to submit entries via Email, however one may X mail entries the following address: X X International Obfuscated C Code Contest X National Semiconductor X Attn: Landon Noll Mail Stop: 7c266 X 1135 Kern Ave. X Sunnyvale, CA 94086 X U.S.A. X XAWARDS: Winners of each category and the best of Show will be posted to X net.announce as well as being published in the May 86 issue of the X "Micro/Systems Journal". Winners also get to receive international X fame/flame for their efforts! X XJUDGING: Awards will be given to the best entry in a number of categories. X The actual category list will vary depending on the types of entries X we receive. At the moment, we are considering using the following: X X * The most obscure algorithm X * The worst abuse of the C preprocessor X * The strangest source layout X * The best small one line program X * The most useful program X * <anything else we need to give recognition to a good entry> X X Judging will be done by myself, Larry Bassel and other local people X who are willing to help out. X X We will attempt to run each of them on a Vax 785/4.2BSD system. X Don't let the lack of such a system stop you! Try to avoid operating X system/machine specific code if you do not have such a system. X Extra points will be given for programs which: X X a) pass lint without complaint X b) do something quasi-interesting X c) are portable X X A larger program size was selected to allow for a wider range of X program ideas. However if you don't need 1024 bytes don't use them. X Given two programs with similar techniques and similar levels of X obfuscation, we will tend to favor the more concise entry. X XPOLL: We want to know what you think is the most poorly coded utility X released with 4.xBSD and/or Sys V. The top results plus the X best flames will be posted along with the contest results. X To vote, please follow the guidelines below: X X 1) Include at the top of the letter: X a) Name (or anonymous), Company/School, City, State and Country. X b) Your path from a major network site, if applicable. X c) the name of the poorly coded utility X d) the name of the operating system on which it is found X e) the line: <<<FLAME ON>>> X f) up to 1024 bytes of flames X g) the line: <<<FLAME OFF>>> X X 2) Confine your vote to the standard set of commands. I.e., don't X flame about local commands or user contributed software. X X 3) Submit your votes via Email to: X X for 4.xBSD: decwrl!nsc!bsd_util X for Sys V: decwrl!nsc!sysV_util X X or, you may send your votes by letter to the same address used by X the contest. Please place your votes on different sheets of paper. X Xchongo <C> /\cc/\ //E*O*F ./1986/rules// echo x - ./1986/stein.c sed -e 's/^X//' > "./1986/stein.c" << '//E*O*F ./1986/stein.c//' Xtypedef char*z;O;o;_=33303285;main(b,Z)z Z;{b=(b>=0||(main(b+1,Z+1),*Z=O%(o=(_% X25))+'0',O/=o,_/=25))&&(b<1||(O=time(&b)%0250600,main(~5,*(z*)Z),write(1,*(z*)Z X,9)));} //E*O*F ./1986/stein.c// echo x - ./1986/stein.hint sed -e 's/^X//' > "./1986/stein.hint" << '//E*O*F ./1986/stein.hint//' XBest one liner: <gustaf!cd-jan> Jan Stein X XNOTE: to avoid problems with news and mail, the single line was split X into 3 lines. Join all lines into a single line to recreate X the original file. X XCompile and link to a filename called 'a.out'. Try the program with the Xfollowing argument: X X a.out ^N^N X X(^N is ASCII control-N). One some machines, ^M^L is needed to get it to Xoutput cleanly. Your system may require another set of characters. XIn time, you will figure out what it does. :-) //E*O*F ./1986/stein.hint// echo x - ./1986/wall.c sed -e 's/^X//' > "./1986/wall.c" << '//E*O*F ./1986/wall.c//' X#define _c(C)_ (C)&('|'+3):c_()(C)>>('\n'-3) __; /**/ X#define C char* X#define keyboard ",,B3-u;.(&*5., /(b*(1\036!a%\031m,,,,,\r\n" X#define main(o,oo)oo(o){ X#define _ ;case XC X#define c_(cc)c cc= X#define C_(sand)_O(sand)witch Xo=keyboard; X#define __ ;break; XC Xccc( Xcc) XC Xcc; X{ XC Xcccc= Xcc;int X#ifndef lint X#define keyboard "dijs QH.soav Vdtnsaoh DmfpaksoQz;kkt oa, -dijs" X#endif Xc; Xmain(;c_(=(*cc);*cc++)c,for); X#define _O(s)s Xmain(0xb+(c>>5),C_(s)) X_'\v' X:__ _'\f': Xmain(c,C_(s)); X_c(8098)_c(6055)_c(14779)_c(10682) X#define O_(O)_O(O)stem(ccc( X_c(15276)_c(11196)_c(15150) X#define _C ;return X_c(11070)_c(15663)_c(11583) X} X__ Xdefault X:c_(+)o[c&__LINE__-007]; Xmain(c_(-)'-'-1,C_(s))_ X0214 X:_ X0216 X:c_(+)025 _ X0207 X:c_(-)4 _ X0233 X:c_(+)' '-1; X}}c_(&)'z'+5; X}_C cccc; X}main(,cc) XC X#define O write(1, Xc="O"; XO_(sy) keyboard)); Xmain(;;,for); Xread(0, Xc,1);* Xc_(&)'~'+1 X;O ccc( Xc), X'\0'); Xmain(*c, XC_(s));_ X4 X:O_(sy)";kkt -oa, dijszdijs QQ"))_C X_ X13 X:O o+' ', X3 X) X#undef main X__ _ 127:O"\b \b",3)__ Xdefault X:O Xc,1) X__}}}main(){ Xcc(); X} //E*O*F ./1986/wall.c// echo x - ./1986/wall.hint sed -e 's/^X//' > "./1986/wall.hint" << '//E*O*F ./1986/wall.hint//' XThe grand prize in most well-rounded in confusion: <sdcrdcf!lwall> Larry Wall X X Larry Wall X System Development Corporation X Santa Monica X California X US of A X XThe original version did not have a `;' character in the first line. XThis caused a number of System V C pre-preprocessors to gripe about a Xsyntax error. X XThis program is a masterpiece of obfuscation and humor. Larry Wall X(the hacker who gave us rn and patch) asks you to compile and consider Xthe warning message generated by the C compiler. Then execute the Xprogram and type charters into its standard input. You will see why Xthe compiler documents the program. //E*O*F ./1986/wall.hint// echo Possible errors detected by \'wc\' [hopefully none]: temp=/tmp/shar$$ trap "rm -f $temp; exit" 0 1 2 3 15 cat > $temp <<\!!! 36 96 530 Makefile 15 115 715 README 15 37 243 applin.c 13 57 358 applin.hint 26 34 718 august.c 15 79 514 august.hint 47 111 1020 bright.c 11 57 386 bright.hint 28 118 991 hague.c 17 93 578 hague.hint 33 72 912 holloway.c 11 66 381 holloway.hint 14 87 938 marshall.c 15 68 425 marshall.hint 18 41 838 pawka.c 10 51 300 pawka.hint 103 634 4048 rules 3 5 168 stein.c 14 85 501 stein.hint 78 125 1025 wall.c 17 103 625 wall.hint 539 2134 16214 total !!! wc ./1986/Makefile ./1986/README ./1986/applin.c ./1986/applin.hint ./1986/august.c ./1986/august.hint ./1986/bright.c ./1986/bright.hint ./1986/hague.c ./1986/hague.hint ./1986/holloway.c ./1986/holloway.hint ./1986/marshall.c ./1986/marshall.hint ./1986/pawka.c ./1986/pawka.hint ./1986/rules ./1986/stein.c ./1986/stein.hint ./1986/wall.c ./1986/wall.hint | sed 's=[^ ]*/==' | diff -b $temp - exit 0 -- [views above shouldn't be viewed as Amdahl views, or as views from Amdahl, or as Amdahl views views, or as views by Mr. Amdahl, or as views from his house]
chongo@amdahl.uts.amdahl.com (Landon Curt Noll) (07/26/88)
# This is a shell archive. Remove anything before this line, then # unpack it by saving it in a file and typing "sh file". (Files # unpacked will be owned by you and have default permissions.) # # This archive contains: # # ./1987/Makefile ./1987/README ./1987/biggar.c ./1987/biggar.hint # ./1987/heckbert.c ./1987/heckbert.hint ./1987/hines.c ./1987/hines.hint # ./1987/korn.c ./1987/korn.hint ./1987/lievaart.c ./1987/lievaart.hint # ./1987/lievaart2.c ./1987/rules ./1987/wall.c ./1987/wall.hint # ./1987/westley.c ./1987/westley.hint echo mkdir ./1987 mkdir ./1987 echo x - ./1987/Makefile sed -e 's/^X//' > "./1987/Makefile" << '//E*O*F ./1987/Makefile//' X# %W% %G% %U% X# X# 1987 makefile X XSHELL=/bin/sh XWINNERS=heckbert wall westley hines korn biggar lievaart lievaart2 X X# for System V style systems XOPSYS=-Dindex=strchr X# for BSD style systems X#OPSYS= X Xall: ${WINNERS} X Xheckbert: heckbert.c X cc ${OPSYS} $? -o $@ Xwall: wall.c X cc $? -o $@ Xwestley: westley.c X cc $? -o $@ Xhines: hines.c X cc $? -o $@ Xkorn: korn.c X cc $? -o $@ Xbiggar: biggar.c X cc -DC="R>0" -DI="if(T)O" -DO="c=write(1,&c,1);" \ X -DP="main(){X}" -DR="read(0,&c,1)" -DT="c!=015" \ X -DW="while(C)I" -DX="char c;W" $? -o $@ Xlievaart: lievaart.c X cc $? -o $@ X# not an official entry Xlievaart2: lievaart2.c X cc $? -o $@ X Xclean: X rm -f core Xclobber: clean X rm -f ${WINNERS} Xinstall: all X @echo are you kidding'??' //E*O*F ./1987/Makefile// echo x - ./1987/README sed -e 's/^X//' > "./1987/README" << '//E*O*F ./1987/README//' X1987 marked the "The Fourth International Obfuscated C Code Contest" X XThe rules for 1987 suggested even more categories than in 1986. Hints Xfor what to do and not to do were also given in the rules. For Xexample, a simple excessive abuse of /lib/cpp was discouraged unless Xthe abuse was unusual. The mailboxes for the contest were moved from Xnsc to amdahl. The practice of posting a preliminary set of rules for Xthe next year was started this year. X XRules and results were posted to comp.lang.c, comp.unix.wizards with Xan announcement in news.announce.important. Micro/Systems Journal Xpublished the 1987 winners. Mark Horton included a version of the 1987 Xwinners in an appendix of his C book. The first announcement of Xwinners at the Summer 87 Usenix was helped by a small fly that Xdanced all over the foils. //E*O*F ./1987/README// echo x - ./1987/biggar.c sed -e 's/^X//' > "./1987/biggar.c" << '//E*O*F ./1987/biggar.c//' XP; //E*O*F ./1987/biggar.c// echo x - ./1987/biggar.hint sed -e 's/^X//' > "./1987/biggar.hint" << '//E*O*F ./1987/biggar.hint//' XBest Abuse of the Rules: <sdcrdcf!markb> Mark Biggar X X Mark Biggar X UNiSYS - System Development Group, Santa Monica X 2525 Colorado AV MD 91-01 X Santa Monica, CA X 90406 X XCompile with: X X cc -DC="R>0" -DI="if(T)O" -DO="c=write(1,&c,1);" -DP="main(){X}"\ X -DR="read(0,&c,1)" -DT="c!=015" -DW="while(C)I" -DX="char c;W" markb.c X XPasses BSD and UTS lint. At least one version of lint is thrown into Xan infinite loop by this entry. X XTry: ... | markb | od -c (remember to compile as indicated above) X XBy changing the compile line you can make this program do anything you Xwant. This is a very efficient way to transfer source, though it Xincreases the size of Makefiles. X XWith only slight variations, this program can be set to many uses. XConsider how easy it would be to release Un*x source in this form; Xso what if the make files grow a little! :-) X XOne vendor's lint got hung in an infinite loop over this entry! X XFYI: We will let Mark get away with this truly sick entry this time, but X for the future on we have placed a limit on the size of a compile line. X XAlso see our comment in Larry Wall's entry regarding Mark's contribution. //E*O*F ./1987/biggar.hint// echo x - ./1987/heckbert.c sed -e 's/^X//' > "./1987/heckbert.c" << '//E*O*F ./1987/heckbert.c//' X#include <ctype.h> X#include <stdio.h> X#define _ define X#_ A putchar X#_ B return X#_ C index Xchar*r,c[300001],*d=">=<=!===||&&->++-->><<",*i,*l,*j,*m,*k,*n,*h,*y;e,u=1,v,w, Xf=1,p,s,x;main(a,b)char**b;{p=a>1?atoi(b[1]):79;r=c+read(0,j=l=i=c,300000);v=g( Xj,&m);for(k=m;v!=2;j=k,m=n,v=w,k=m){w=g(k,&n);if(v==1&&m-j==1&&*j==35)e&&A(10), Xe=f=0;if(!f&&v==3&&(char*)C(j,10)<m)A(10),e=0,f=1;else if(v>2&&(u||w)&&(f||u)&& X(l-i>1||*i!=61||n-k>1||!C("-*&",*k)))continue;else if(v==3)if(f&&e+1+n-k>p&&e)A X(10),e=0;else A(32),e++;else{if(f&&e+m-j>p&&e)A(10),e=0;e+=m-j;k=j;while(k<m)A( X*k++);}i=j;l=m;u=v;}e&&A(10);}g(j,m)char*j,**m;{if(j>=r)B*m=j,2;s=isdigit(*j)|| X*j==46&&isdigit(j[1]);for(h=j;h<r;h++)if(!isalnum(*h)&&*h!=95&&(!s||*h!=46)&&(! Xs||h[-1]!=101&&h[-1]!=69||!C("+-",*h)))break;if(h>j)B*m=h,0;x=1;for(h=j;h<r&&C( X" \t\n",*h);h++);if(h>j)h--,x=3;if(*j==34||*j==39)for(h=j+1;h<r&&*h!=*j;h++)if( X*h==92)h++;for(y=d;*y&&strncmp(y,j,2);y+=2);if(*y)h=j+1;if(!strncmp("/*",j,2)){ Xh=j+2;while(*++h!=42||*++h!=47);x=4;}*m=h+1;B x;} //E*O*F ./1987/heckbert.c// echo x - ./1987/heckbert.hint sed -e 's/^X//' > "./1987/heckbert.hint" << '//E*O*F ./1987/heckbert.hint//' XBest Obfuscator of Programs: <pixar!ph> Paul Heckbert X X Paul Heckbert X Pixar X XTry: ph 40 < ph.c > foo.c; cc foo.c -o ph X ph 20 < a_C_prog.c > bar.c; cc bar.c X XThe judges used this program to fold up very long lines which the XBSD fold(1) was unable to process. This program has been added Xto the contest tool chest. X XOn System V systems, compile with: -Dindex=strchr. XTo compile on a 16 bit machine, change 300000's to 30000. //E*O*F ./1987/heckbert.hint// echo x - ./1987/hines.c sed -e 's/^X//' > "./1987/hines.c" << '//E*O*F ./1987/hines.c//' X#include <stdio.h> X#include <malloc.h> Xmain(togo,toog) Xint togo; Xchar *toog[]; X{char *ogto, tgoo[80];FILE *ogot; int oogt=0, ootg, otog=79, Xottg=1;if ( togo== ottg) goto gogo; goto goog; ggot: Xif ( fgets( tgoo, otog, ogot)) goto gtgo; goto gott; Xgtot: exit(); ogtg: ++oogt; goto ogoo; togg: if ( ootg > 0) Xgoto oggt; goto ggot; ogog: if ( !ogot) goto gogo; Xgoto ggto; gtto: printf( "%d goto \'s\n", oogt); goto Xgtot; oggt: if ( !memcmp( ogto, "goto", 4)) goto otgg; Xgoto gooo; gogo: exit( ottg); tggo: ootg= strlen(tgoo); Xgoto tgog; oogo: --ootg; goto togg; gooo: ++ogto; goto Xoogo; gott: fclose( ogot); goto gtto; otgg: ogto= ogto +3; Xgoto ogtg; tgog: ootg-=4;goto togg; gtgo: ogto= tgoo; Xgoto tggo; ogoo: ootg-=3;goto gooo; goog: ogot= fopen( Xtoog[ ottg], "r"); goto ogog; ggto: ogto= tgoo; goto Xggot;} //E*O*F ./1987/hines.c// echo x - ./1987/hines.hint sed -e 's/^X//' > "./1987/hines.hint" << '//E*O*F ./1987/hines.hint//' XWorst Style: <grebyn!avalon> Spencer Hines X X Spencer Hines X OnLine Computer Systems X 4200 Farragut Street X Hyattsville, MD X 20781 X USA X XTry: avalon avalon.c X XThis program was designed to maximize the bother function for Xstructured programmers. This program takes goto statements to their Xlogical conclusion. The layout and choice of names are classic. X XWe consider this to be a beautiful counter-example for Frank Rubin's Xletter to ACM form titled: `` "GOTO Considered Harmful" Considered Harmful ''. XSee the Communications of the ACM, March 1987, Page 195-196. //E*O*F ./1987/hines.hint// echo x - ./1987/korn.c sed -e 's/^X//' > "./1987/korn.c" << '//E*O*F ./1987/korn.c//' X main() { printf(&unix["\021%six\012\0"],(unix)["have"]+"fun"-0x60);} //E*O*F ./1987/korn.c// echo x - ./1987/korn.hint sed -e 's/^X//' > "./1987/korn.hint" << '//E*O*F ./1987/korn.hint//' XBest One Liner: <ulysses!dgk> David Korn X X David Korn X AT&T Bell Labs X MH 3C-526B, AT&T Bell Labs X Murray Hill, NJ X 07974 X USA X XThe Judges believe that this is the best one line entry ever received. XCompile on a UN*X system, or at least using a C implementation that Xfakes it. Very few people are able to determine what this program Xdoes by visual inspection. I suggest that you stop reading this Xsection right now and see if you are one of the few people who can. X XSeveral points are important to understand in this program: X X 1) What is the symbol `unix' and what is its value in the program? X Clearly `unix' is not a function, and since `unix' is not declared X to be a data type (such as int, char, struct foo, enum, ...) X what must `unix' be? X X 2) What is the value of the symbol "have"? (hint: the value is X NOT 4 characters, or 'h', or a string) Consider the fact that: X X char *x; X X defines a pointer to a character (i.e. an address), and that X the `=' assigns things is compatible types. Since: X X x = "have"; X X is legal C, what type of value is "have"? X X 3) Note that the following expressions yield the same value: X X x[3] *(x+3) *(3+x) X X since addition is communitive. What can be said about the value: X X 3[x] X XDavid Korn's /bin/ksh provides us with a greatly improved version of Xthe /bin/sh. The source for v7's /bin/sh greatly inspired this contest. //E*O*F ./1987/korn.hint// echo x - ./1987/lievaart.c sed -e 's/^X//' > "./1987/lievaart.c" << '//E*O*F ./1987/lievaart.c//' X#define D define X#D Y return X#D R for X#D e while X#D I printf X#D l int X#D C y=v+111;H(x,v)*y++= *x X#D H(a,b)R(a=b+11;a<b+89;a++) X#D s(a)t=scanf("%d",&a) Xl V[1100],u,r[]={-1,-11,-10,-9,1,11,10,9},h[]={11,18,81,88},ih[]={22,27,72,77}, Xbz,lv=60,*x,*y,m,t;S(d,v,f,a,b)l*v;{l c=0,*n=v+100,bw=d<u-1?a:-9000,w,z,i,zb,q= X3-f;if(d>u){R(w=i=0;i<4;i++)w+=(m=v[h[i]])==f?300:m==q?-300:(t=v[ih[i]])==f?-50 X:t==q?50:0;return w;}H(z,0){if(GZ(v,z,f,100)){c++;w= -S(d+1,n,q,-b,-bw);if(w>bw X){zb=z;bw=w;if(w>=b||w>=8003)Y w;}}}if(!c){bz=0;C;Y-S(d+1,n,q,-b,-bw);}bz=zb;Y Xd>=u-1?bw+(c<<3):bw;}main(){R(;t<1100;t+=100)R(m=0;m<100;m++)V[t+m]=m<11||m>88 X||(m+1)%10<2?3:0;V[44]=V[55]=1;V[45]=V[54]=2;I("Level:");s(u);e(lv>0){do{I("Yo\ Xu:");s(m);}e(!GZ(V,m,2,0)&&m!=99);if(m!=99)lv--;if(lv<15&&u<10)u+=2;I("Wait\n") X;I("Value:%d\n",S(0,V,1,-9000,9000));I("move: %d\n",(lv-=GZ(V,bz,1,0),bz));}}GZ X(v,z,f,o)l*v;{l*j,q=3-f,g=0,i,h,*k=v+z;if(*k==0)R(i=7;i>=0;i--){j=k+(h=r[i]);e( X*j==q)j+=h;if(*j==f&&j-h!=k){if(!g){g=1;C;}e(j!=k)*((j-=h)+o)=f;}}Y g;} //E*O*F ./1987/lievaart.c// echo x - ./1987/lievaart.hint sed -e 's/^X//' > "./1987/lievaart.hint" << '//E*O*F ./1987/lievaart.hint//' XGrand Prize: <botter!rblieva> Roemer B. Lievaart X X Roemer B. Lievaart X VU Informatica X Churchilllaan 173-IV X Amsterdam, The Netherlands X XWe believe that you too will be amazed at just how much power Mr. Lievaart Xpacked into 1024 bytes! X XThis Plays the game of reversi (Othello)! Compile and run. It then Xasks for a playing level. Enter 0-10 (easy-hard). It then asks for Xyour move. A move is a number within 11-88, or a 99 to pass. Illegal Xmoves (except for an illegal pass) are rejected. Then the computer Xdoes its move (or a 0 to pass), until the board is full. It plays Xrather well, for such a small program! Lievaart had to leave out the Xboard printing routine, so you'll have to take a real game board to Xplay it. ... Also due to space-limitations (the rules for 1987 had a Xlimit of 1024 byes), Lievaart took out the passing-handler, which Xmakes its ending-game rather poor. But further it knows all the Xrules, uses alpha-beta pruning, and it plays f.i. on mobility(!). XMost important: it can play a pretty good game of Reversi! X XThe Author was kind enough to supply the fully functional version of the Xprogram. The file lievaart2.c contains what the program would have Xbeen without the size restriction. This version has the full end game Xlogic and displays the board after each move! //E*O*F ./1987/lievaart.hint// echo x - ./1987/lievaart2.c sed -e 's/^X//' > "./1987/lievaart2.c" << '//E*O*F ./1987/lievaart2.c//' X#define D define X#D Y return X#D R for X#D e while X#D I printf X#D l int X#D W if X#D C y=v+111;H(x,v)*y++= *x X#D H(a,b)R(a=b+11;a<b+89;a++) X#D s(a)t=scanf("%d",&a) X#D U Z I X#D Z I("123\ X45678\n");H(x,V){putchar(".XO"[*x]);W((x-V)%10==8){x+=2;I("%d\n",(x-V)/10-1);}} Xl V[1600],u,r[]={-1,-11,-10,-9,1,11,10,9},h[]={11,18,81,88},ih[]={22,27,72,77}, Xbz,lv=60,*x,*y,m,t;S(d,v,f,_,a,b)l*v;{l c=0,*n=v+100,j=d<u-1?a:-9000,w,z,i,g,q= X3-f;W(d>u){R(w=i=0;i<4;i++)w+=(m=v[h[i]])==f?300:m==q?-300:(t=v[ih[i]])==f?-50: Xt==q?50:0;Y w;}H(z,0){W(E(v,z,f,100)){c++;w= -S(d+1,n,q,0,-b,-j);W(w>j){g=bz=z; Xj=w;W(w>=b||w>=8003)Y w;}}}W(!c){g=0;W(_){H(x,v)c+= *x==f?1:*x==3-f?-1:0;Y c>0? X8000+c:c-8000;}C;j= -S(d+1,n,q,1,-b,-j);}bz=g;Y d>=u-1?j+(c<<3):j;}main(){R(;t< X1600;t+=100)R(m=0;m<100;m++)V[t+m]=m<11||m>88||(m+1)%10<2?3:0;I("Level:");V[44] X=V[55]=1;V[45]=V[54]=2;s(u);e(lv>0){Z do{I("You:");s(m);}e(!E(V,m,2,0)&&m!=99); XW(m!=99)lv--;W(lv<15&&u<10)u+=2;U("Wait\n");I("Value:%d\n",S(0,V,1,0,-9000,9000 X));I("move: %d\n",(lv-=E(V,bz,1,0),bz));}}E(v,z,f,o)l*v;{l*j,q=3-f,g=0,i,w,*k=v X+z;W(*k==0)R(i=7;i>=0;i--){j=k+(w=r[i]);e(*j==q)j+=w;W(*j==f&&j-w!=k){W(!g){g=1 X;C;}e(j!=k)*((j-=w)+o)=f;}}Y g;} //E*O*F ./1987/lievaart2.c// echo x - ./1987/rules sed -e 's/^X//' > "./1987/rules" << '//E*O*F ./1987/rules//' XWARNING: The rules and mailing address for the contest change from year X to year. Be sure that you consult the current set of rules X before submitting entries. X------------------------------------------------------------------------------ X XSubject: 4th International Obfuscated C Code Contest Rules XNewsgroups: comp.lang.c,comp.unix.wizards XKeywords: rules,1987,obfuscate,contest X XGOALS OF THE CONTEST: X X * To write the most Obscure/Obfuscated C program under the rules below. X * To show what should NOT be done in C programs. X * To provide a safe forum for poor C code. :-) X XRULES: X 1) The source must be 1024 characters long or less. NO EXCEPTIONS! X X 2) To help us process your entries, we ask that you submit entries X in the following format: (please include the --- lines) X X---start of header items--- Xname: Xorg: Xemail address: Xpostal address: Xenvironment: Xremarks: X---start of entry--- XX <place obfuscated source of 1024 characters or less here> XX <add a leading X to each line to avoid problems with mailers> XX <leading X's do not count toward the source character count> XX <the first X of each source line will be removed prior to compilation> XX <newlines count as 1 character> XX <assume a standard 8 character tab stop> X---end of entry--- X X 3) Regarding the header items: X X * All header items except 'remark' are optional. If you do not X wish to answer an item, indicate so by the string: ***NONE*** X Any text outside of the above format will be kept confidential. X X * You can remain anonymous. If the name item is: ***ANONYMOUS*** X all items except the 'remarks' item will not be relased. X X * Indicate the name of your Company or School in the 'org' item. X X * The 'email address' item asks for a network path from a major X site (such as amdahl) to your mailbox. X X * If you give a 'postal address', please include your Country. X X * Give the machine and operating system (i.e., Un*x version) on X which your program ran. X X * The 'remarks' item is not optional. Please indicate: X - how to execute or compile if something special is required X - type of input or argument needed, if applicable X - what this program does X - any other remarks you wish to make X X * If you need more than one line on a header item, place X tab or space characters at the beginning of each additional line. X X 4) The entry should be written in a common C. (K&R + common extensions) X X 5) The program must be of original work. All programs must be X in the public domain. All copyrighted programs will be rejected. X X 6) Entries must be received before 30-May-87 0:00 GMT. X Email your entries to: X X ...!amdahl!obfuscate X X Amdahl talks to hplabs, decwrl, pyramid, seismo and cbosgd. X We will attempt to Email a confirmation of receipt of contest X entries, however since Email is not reliable you may not receive it. X People are encouraged to submit entries via Email, however X one may mail entries the following postal address: X X Landon Curt Noll X Amdahl Corp. X 1250 E. Arques Ave. M/S 316 X P.O. Box 3470 X Sunnyvale, CA X 94088-3470 X U.S.A. X X Write the words: "International Obfuscated C Code Contest" near the X bottom left corner of the envelope. X X 8) Contest entries sent in by post should indicate where TAB characters X are to be placed, otherwise space characters will be assumed. Each X line will be assumed to contain a newline character. The leading X 'X' will serve to indicate where each source line starts. X X 9) Each person may submit up to 5 entries. Multiple entries must X be sent in separate Email letters or postal envelopes. X X 10) People are encouraged to examine winners of the previous X contests. A copy of these entries was posted to mod.sources X on or about 12-Mar-87. Contact the mod.sources moderator X if you missed that article. Keep in mind that rules change from X year to year, so some winning entries may not be valid X entries this year. Also what was unique and novel one X year can get 'old' the next year. X X XANNOUNCEMENT OF WINNERS: X X * First announcement will be at the Summer 87 Usenix BOF. X X * An announcement will be posted to mod.announce near X mid June 1987 stating to which newsgroup the winners X have been posted. X X * An article containing the winning entries will be published X in a future issue of the "Micro/Systems Journal". X X * Winners receive international fame and flames! :-) X X XJUDGING: X Awards will be given to the best entry in a number of categories. X The actual category list will vary depending on the types of entries X we receive. At the moment, we are considering using the following: X X * The best small one line program X * The most obscure algorithm X * The worst abuse of the C preprocessor (note warnings below) X * The strangest source layout X * The most useful obfuscated program X * <anything else so strange that it deserves an award> X X Extra points will be given for programs which: X X * pass lint without complaint X * do something quasi-interesting X * are portable X * are unique in their obfuscation style X * are concise X X Points will be taken away for programs that: X X * are very hardware or Un*x version specific X * dump core or have compiler warnings X (we won't take points away if you warn us in the remark item) X * fail to compile X * obfuscate only by overuse of #defines X (you should do this ONLY if your use is unusual) X * are similar to previous winners X * are similar to previous losers :-) X X The Judging will be done by Landon Noll and Larry Bassel. X Comments & questions (not entries) about the contest can be Emailed to: X X ...!amdahl!judges X Xchongo <Landon Curt Noll> /\cc/\ XLarry Bassel //E*O*F ./1987/rules// echo x - ./1987/wall.c sed -e 's/^X//' > "./1987/wall.c" << '//E*O*F ./1987/wall.c//' X#define iv 4 X#define v ;(void X#define XI(xi)int xi[iv*'V']; X#define L(c,l,i)c(){d(l);m(i);} X#include <stdio.h> Xint*cc,c,i,ix='\t',exit(),X='\n'*'\d';XI(VI)XI(xi)extern(*vi[])(),(* Xsignal())();char*V,cm,D['x'],M='\n',I,*gets();L(MV,V,(c+='d',ix))m(x){v) Xsignal(X/'I',vi[x]);}d(x)char*x;{v)write(i,x,i);}L(MC,V,M+I)xv(){c>=i?m( Xc/M/M+M):(d(&M),m(cm));}L(mi,V+cm,M)L(md,V,M)MM(){c=c*M%X;V-=cm;m(ix);} XLXX(){gets(D)||(vi[iv])();c=atoi(D);while(c>=X){c-=X;d("m");}V="ivxlcdm" X+iv;m(ix);}LV(){c-=c;while((i=cc[*D=getchar()])>-I)i?(c?(c<i&&l(-c-c, X"%d"),l(i,"+%d")):l(i,"(%d")):(c&&l(M,")"),l(*D,"%c")),c=i;c&&l(X,")"),l X(-i,"%c");m(iv-!(i&I));}L(ml,V,'\f')li(){m(cm+!isatty(i=I));}ii(){m(c=cm X= ++I)v)pipe(VI);cc=xi+cm++;for(V="jWYmDEnX";*V;V++)xi[*V^' ']=c,xi[*V++] X=c,c*=M,xi[*V^' ']=xi[*V]=c>>I;cc[-I]-=ix v)close(*VI);cc[M]-=M;}main(){ X(*vi)();for(;v)write(VI[I],V,M));}l(xl,lx)char*lx;{v)printf(lx,xl)v) Xfflush(stdout);}L(xx,V+I,(c-=X/cm,ix))int(*vi[])()={ii,li,LXX,LV,exit,l, Xd,l,d,xv,MM,md,MC,ml,MV,xx,xx,xx,xx,MV,mi}; //E*O*F ./1987/wall.c// echo x - ./1987/wall.hint sed -e 's/^X//' > "./1987/wall.hint" << '//E*O*F ./1987/wall.hint//' XMost Useful Obfuscation: <sdcrdcf!lwall> Larry Wall X X Larry Wall X Unisys - System Development Group Santa Monica X 9132 Kester Ave X Panorama City, CA 91402 USA X XTry: lwall | bc | lwall Xinput: x*x Xinput: c^2 X XAlso try: lwall | bc and lwall | cat X XWhat we found amazing was how the flow of control was transferred Xbetween subroutines. Careful inspection will show that the array of Xpointers to functions named `vi' refers to functions which seem to not Xbe directly called. Even so, these pointers to functions are being Xused as an argument to signal. Can you determine why this is being Xdone and how it is being exploited? X XSome compilers complained about this file, so we changed: '=++I' to '= ++I'. //E*O*F ./1987/wall.hint// echo x - ./1987/westley.c sed -e 's/^X//' > "./1987/westley.c" << '//E*O*F ./1987/westley.c//' X char rahc X [ ] X = X "\n/" X , X redivider X [ ] X = X "Able was I ere I saw elbA" X , X * X deliver,reviled X = X 1+1 X , X niam ; main X ( ) X {/*\} X \*/ X int tni X = X 0x0 X , X rahctup,putchar X ( ) X ,LACEDx0 = 0xDECAL, X rof ; for X (;(int) (tni);) X (int) (tni) X = reviled ; deliver = X redivider X ; Xfor ((int)(tni)++,++reviled;reviled* *deliver;deliver++,++(int)(tni)) rof X = X (int) -1- (tni) X ;reviled--;--deliver; X (tni) = (int) X - 0xDECAL + LACEDx0 - X rof ; for X (reviled--,(int)--(tni);(int) (tni);(int)--(tni),--deliver) X rahctup = putchar X (reviled* *deliver) X ; X rahctup * putchar X ((char) * (rahc)) X ; X /*\ X {\*/} //E*O*F ./1987/westley.c// echo x - ./1987/westley.hint sed -e 's/^X//' > "./1987/westley.hint" << '//E*O*F ./1987/westley.hint//' XBest Layout: <starfire!merlyn> Brian Westley X X Brian Westley (aka Merlyn Leroy on usenet) X Starfire Consulting X 1121 Hamline Ave. N. #17 X St. Paul, MN X 55108 X USA X XPutchar must exist in the C library and not just as a macro. XIf it fails to compile, add the line: #include <stdio.h> at the Xtop of the program. X XLine by line symmetry performed better than any C beautifier. Think Xof if it as a C ink blot. :-) //E*O*F ./1987/westley.hint// echo Possible errors detected by \'wc\' [hopefully none]: temp=/tmp/shar$$ trap "rm -f $temp; exit" 0 1 2 3 15 cat > $temp <<\!!! 40 112 726 Makefile 15 136 816 README 1 1 3 biggar.c 32 191 1141 biggar.hint 18 33 1021 heckbert.c 14 76 430 heckbert.hint 19 130 953 hines.c 18 82 565 hines.hint 1 3 70 korn.c 44 242 1401 korn.hint 20 44 1022 lievaart.c 27 224 1303 lievaart.hint 25 61 1175 lievaart2.c 161 917 5745 rules 18 30 1021 wall.c 21 120 708 wall.hint 48 93 908 westley.c 15 73 412 westley.hint 537 2568 19420 total !!! wc ./1987/Makefile ./1987/README ./1987/biggar.c ./1987/biggar.hint ./1987/heckbert.c ./1987/heckbert.hint ./1987/hines.c ./1987/hines.hint ./1987/korn.c ./1987/korn.hint ./1987/lievaart.c ./1987/lievaart.hint ./1987/lievaart2.c ./1987/rules ./1987/wall.c ./1987/wall.hint ./1987/westley.c ./1987/westley.hint | sed 's=[^ ]*/==' | diff -b $temp - exit 0 -- [views above shouldn't be viewed as Amdahl views, or as views from Amdahl, or as Amdahl views views, or as views by Mr. Amdahl, or as views from his house]
chongo@amdahl.uts.amdahl.com (Landon Curt Noll) (07/26/88)
# This is a shell archive. Remove anything before this line, then # unpack it by saving it in a file and typing "sh file". (Files # unpacked will be owned by you and have default permissions.) # # This archive contains: # # ./1988/Makefile ./1988/README ./1988/applin.c ./1988/applin.hint # ./1988/dale.c ./1988/dale.hint ./1988/isaak.c ./1988/isaak.encode # ./1988/isaak.hint ./1988/litmaath.c ./1988/litmaath.hint # ./1988/phillipps.c ./1988/phillipps.hint ./1988/reddy.c # ./1988/reddy.hint ./1988/robison.c ./1988/robison.hint ./1988/rules # ./1988/spinellis.c ./1988/spinellis.data ./1988/spinellis.hint # ./1988/westley.c ./1988/westley.hint ./1988/zsmall.c echo mkdir ./1988 mkdir ./1988 echo x - ./1988/Makefile sed -e 's/^X//' > "./1988/Makefile" << '//E*O*F ./1988/Makefile//' X# %W% %G% %U% X# X# 1988 makefile X XSHELL=/bin/sh XCFLAGS=-O XCC=cc XCPP=/lib/cpp X# you may need a version of cpp that is faster and/or allows more symbols X# than the standard cpp. If so, adjust the BIG_CPP below. X# X# If you have the GNU cpp, you should use it below as it is MUCH faster X# than the standard cpp and does not have problems with memory usage. X# However you should note that the non-ANSI nature of defining symbols X# that start with '#' prevents GNU cpp from doing the initial pass. X# Thus you should not use the GNU cpp for the ${CPP} symbol. XBIG_CPP=${CPP} X XWINNERS=dale phillipps robison westley reddy isaak \ X litmaath spinellis zsmall X Xall: ${WINNERS} X Xdale: dale.c X ${CC} ${CFLAGS} $? -o $@ Xphillipps: phillipps.c X ${CC} ${CFLAGS} $? -o $@ Xrobison: robison.c X ${CC} ${CFLAGS} $? -o $@ Xwestley: westley.c X ${CC} ${CFLAGS} $? -o $@ Xreddy: reddy.c X ${CC} ${CFLAGS} $? -o $@ Xisaak: isaak.c X ${CC} ${CFLAGS} -DI=B -DO=- -Dy $? -o $@ Xlitmaath: litmaath.c X ${CC} ${CFLAGS} $? -o $@ Xspinellis: spinellis.c spinellis.data X @echo This program can not be portably compiled with a makefile X @echo because it reads from /dev/tty. X @echo Compile this program with: cc spinellis.c -o spinellis X @echo and type the following text followed by an EOF '(^D)'. X @cat spinellis.data X @-if [ ! -f spinellis ]; then \ X touch spinellis; \ X fi X X# not an official entry X# X# The 'zsmall.c' program was obtained from 'applin.c' by reducing its recursion X# and running it thru the initial /lib/cpp. That is, 'zsmall.c' is a small X# version of the 'z.c' file as produced by the 'applin' make rule below. Xzsmall: zsmall.c X @echo this reduced version of applin.c can take some time to compile... X ${CC} ${CFLAGS} zsmall.c -o $@ X X# This entry took 75 minutes to compile on a Amdahl 5980-300E X# (a 55658 Dhyrstone/sec/cpu machine) using the System V cpp. X# (The GNU cpp when defined as BIG_CPP took only 45 seconds) X# Your cpp may not be able to compile it due to a common bug X# that results in ${CPP} running out of space. The routine X# 'zsmall' is a smaller version of the applin.c entry. Xapplin: applin.c X ${CPP} '-DM=#include "z.c"' '-DR=#include' '-DF=#if' \ X '-DI=#ifdef' '-DL=#else' '-DE=#endif' '-DN=#ifndef' \ X '-DD=#define' '-DU=#undef' applin.c z.c X @echo this is going to take a very very long time to C-preprocess X @echo perhaps you should do: make zsmall instead X ${BIG_CPP} z.c > large.c X @echo now for the real compile... X ${CC} ${CFLAGS} large.c -o $@ X Xclean: X rm -f core *.o Xclobber: clean X rm -f ${WINNERS} applin Xnuke: clobber X rm -f large.c z.c Xinstall: all X cat ${WINNERS} > /dev/null //E*O*F ./1988/Makefile// echo x - ./1988/README sed -e 's/^X//' > "./1988/README" << '//E*O*F ./1988/README//' X1988 marked the "The Fifth International Obfuscated C Code Contest" X XThe maximum size of entries was raised from 1024 to 1536 bytes, however Xsmaller entries were encouraged. Due to the "Best Abuse of the Rules" Xwinner of 1987, a limit of 160 chars in the compile line was introduced. X XThis year, the Grand Prize was given to the most unusual entry and best Xabuse of the C Preprocessor rather than the most well rounded entry. X XRules and results were posted to comp.lang.c, comp.sources.unix and Xalt.sources. The 1988 winners will be published in the Micro/Systems XJournal. X XWinning entries for previous years were repackaged with each year Xbeing in its own directory. Make files and hints were also provided. XThe package was posted to the: comp.sources.unix newsgroup. They are Xalso available on a wide number of Usenet archive sites. //E*O*F ./1988/README// echo x - ./1988/applin.c sed -e 's/^X//' > "./1988/applin.c" << '//E*O*F ./1988/applin.c//' XI a XU a XI b XU b XI c XU c XI d XU d XI e XU e XI f XU f XI g XU g XI h XU h XI i XU i XI j XU j XI k XU k XI l XU l XI m XU m XL XD m XE XL XD l XE XL XD k XE XL XD j XE XL XD i XE XL XD h XE XL XD g XE XL XD f XE XL XD e XE XL XD d XE XL XD c XE XL XD b XE XL XD a XE XI m XD n (1<<9) XL XD n 0 XE XI l XD o (1<<8) XL XD o 0 XE XI k XD p (1<<7) XL XD p 0 XE XI j XD q (1<<6) XL XD q 0 XE XI i XD r (1<<5) XL XD r 0 XE XI h XD s (1<<4) XL XD s 0 XE XI g XD t (1<<3) XL XD t 0 XE XI f XD u (1<<2) XL XD u 0 XE XI e XD v (1<<1) XL XD v 0 XE XD vv (n+o+p+q+r+s+t+u+v+1) XD ff (defined(d)*16+defined(c)*8+defined(b)*4+defined(a)*2+1) XF vv==1 XU vv XD vv 2 XE XF ff<vv XF ff!=1 XF (vv/ff)*ff==vv XN dd XD dd XE XE XE XE XF ff==31 XI dd XU dd XL Xprintf("%d\n", vv); XE XE XU ff XU vv XU n XU o XU p XU q XU r XU s XU t XU u XU v XI w XI x XI y XN z XD z XE XL XD y XE XL XD x XE XL XD w XR <stdio.h> Xmain(){ XE XN z XM XM XM XM XM XM XM XM XM XM XM XM XM XM XM XE XI z XU z XL XI y XU y XL XI x XU x XL XI w XU w X} XE XE XE XE //E*O*F ./1988/applin.c// echo x - ./1988/applin.hint sed -e 's/^X//' > "./1988/applin.hint" << '//E*O*F ./1988/applin.hint//' XBest of show: <hpfclg!neutron> Jack Applin X X Jack Applin X Hewlett-Packard X 3404 E. Harmony Rd X Ft. Collins, CO X 80525 X USA X XCompile and execute with no argument, if you can! X XThis entry is by far the most unusual abuse of the C preprocessor that Xwe have received thus far. Nearly all of the real work is done in the Xpreprocessor! X XWhen we compiled applin.c on an Amdahl 5890-300E, we found that it Xspent over 75 minutes in the System V C preprocessor! Besides showing Xthat the standard System V cpp is slow, it showed that it contained a Xmemory usage problem. The applin.c only uses 29 different preprocessor Xsymbols (besides <stdio.h> and yet the preprocessor ran out of space! X XThe GNU C preprocessor took less than 45 seconds to perform the 2nd pass Xon the Amdahl 5890-300E. But due to the ANSI-ness of GNU cpp (v. 1-21), Xit was not able to cleanly substitute a symbol that began with a '#'. XClearly the GNU C preprocessor is faster. X XA smaller version of applin.c can be found in zsmall.c. Your machine Xmay have an easier time with this program. See the Makefile for details. //E*O*F ./1988/applin.hint// echo x - ./1988/dale.c sed -e 's/^X//' > "./1988/dale.c" << '//E*O*F ./1988/dale.c//' X#define _ define X#_ P char X#_ p int X#_ O close( X#_ H strlen(* X#_ h case_2 X#_ case_3 default X#_ while switch X#_ L if X#_ I goto X#_ l 1 X#_ f write X#_ J else X#_ a(x)get/***/x/***/id()) XP z[l<<(1<<l<<1)<<1<<(l<<1)<<(l<<l<<l)<<1],*v;p r,A=0,c=1; Xq(Q)P*Q;{L(*++Q){*Q-=7;q(Q);}}main(V,C)P**C;{ Xp Z=chroot("/");L(!a(u)execv((q(v="/ipu6ljov"),v),C);Z-=kill(l); Xwhile(V){ Xcase_3:L(!(*C[c]-'-')&&!(C[c][c]-'n')&&!C[c][c<<c])V--,C++,Z=c; Xcase 1:O/*/*/0)+O(c*c-c+c/c)<<(c*c));dup(c);O/*/*/c);pipe(z);L( X for/*/(;;);/*/k()){O/*/*/c); Xcase_2:L(!--V){O/*/*/c*c+c);wait(A+c*c-c);L(!Z)f(A,"\n",c);return(A*a(g);};C++; X f(c/c+c*c,*C,H C));I h;}J O/*/*/c/c+V/V+A*(p)C); Xcase 0:c=read(1,z,r=H++C));L(c){L(A++)f('-'-'-'-'+'+'+'," ",'/'/'/'); X f(A-A+c-r-c+r,z,r);}J _exit(Z?Z-Z:Z);};main(chroot("/tmp")+l,C); X} //E*O*F ./1988/dale.c// echo x - ./1988/dale.hint sed -e 's/^X//' > "./1988/dale.hint" << '//E*O*F ./1988/dale.hint//' XBest abuse of system calls: <grue@banana.cs.uq.oz> Paul Dale X X Paul Dale X University of Queensland X Computer Science Dept X Dept of Computer Science X Uni of Qld, 4067 X Australia X XTry: dale hello world X dale these files are in this directory: * X XThis entry has a very twisted flow of control via recursion, iteration Xand multi-processing. Try to understand what is being done with the Xsystem calls. X XNOTE: This program assumes the ascii character set is being used. //E*O*F ./1988/dale.hint// echo x - ./1988/isaak.c sed -e 's/^X//' > "./1988/isaak.c" << '//E*O*F ./1988/isaak.c//' Xmain(){} X#define P define X#P U ifdef X#P main Si X#U y X#undef y X#include "isaak.c" XPb X#else Xchar*K="4499999;8 9+jW*':'TZhD m:*h.4-j'9(z7Q>r*:G#FS]mATIdMZY^HaKFZZ\ XJyJw:X49@eJj1,Z'\\c^jGU@IXTF@9P2i:gAZx0pD*W3\\<ZZs1:.~Z8U:P<\\:ZOI0GBPZ7",*H X,S[5202],*B="oA9BA6iN`]`Ph>5F4::M6A69@6I{g[Za__]NPV``aV\177E4C5CG;4C<BEJG;\ X?LGlSZ[Y_!oYi@uXPzLFyPOYP][]`RTaQo86564CAHCG4ES",*F,N;int Bk,V;Y X#endif X#P C K/16-2 X(){char*H;F O=-263;for(H="$+---+|||";*++H;)*(F O=(*H+5&129)+1)= *H;F X#P W sprintf( XO= -132;}I/**/r(){if((N= *IO/**/O%(21 O -5)+81 O 16)==107)N+= X#undef I X*K++&15;*F++=N;return*K;} X#undef O X#P I K X#P O + X#U N Xexit(N){F=WH=S,"%5060d")+385;while(Br(),++B,Kr())F+=(N= X*B++/26-1)?(")21["[N]-46)*N*4-22:-3194;while(*--K!=9){while(!(*++H+5&64)); XF=(40-"(\206/"[((H-S)%130+45)/57]<<3)+H;*F++=*H++;*F= X*H==106?32:*H;Y();W WF-131,"%-3d",++Bk)+260,"%3d",V+= X*C?*C:"hijpqv"[*--C]-106);Pb();}for(H=S;*H||(int)_exit(0);H+=130)write(1,1+W XF+3,"%c%-73.73s\n",0,H),74);} X#endif X#undef U X#P U ifndef X#include <stdio.h> //E*O*F ./1988/isaak.c// echo x - ./1988/isaak.encode sed -e 's/^X//' > "./1988/isaak.encode" << '//E*O*F ./1988/isaak.encode//' Xbegin 666 isaak.output XM*RTM+2L@(" @(" @(" @(" @(" @(" @(" @(" @(" @(" @(" @(" @(" @ XM(" @(" @(" @(" @(" @(" @(" @(" K+2TM*PI\,2 @?" @(" @(" @(" @ XM(" @(" @(" @(" @(" @(" @(" @(" @(" @(" @(" @(" @(" @(" @(" @ XM(" @(" @('PR("!\"GQ(("!\(" @(" @(" @(" @(" @(" @(" @(" @(" @ XM(" @(" @(" @(" @(" @(" @(" @(" @(" @(" @(" @(" @?$AE('P*?" @ XM,7P@(" @(" @(" @(" @(" @(" @(" @(" @(" @(" @(" @(" @(" @(" @ XM(" @(" @(" @(" @(" @(" @("!\(" T? HK+2TM*RTM+2L@(" @(" @(" @ XM(" @(" @(" @(" @(" @(" @(" @(" @(" @(" K+2TM*RTM+2LM+2TK+2TM XM*RTM+2LM+2TK"GPS("!\-" @?" @(" @(" @(" @(" @(" @(" @(" @(" @ XM(" @(" @(" @(" @('PU("!\-B @?#<@('PX("!\.2 @?#$P('P*?$QI('Q" XM92!\(" @(" @(" @(" @(" @(" @(" @(" @(" @(" @(" @(" @(" @?$(@ XM('Q#("!\3B @?$\@('Q&("!\3F4@? I\(" W?" @.7P@(" @(" @(" @(" @ XM(" @(" @(" @(" @(" @(" @(" @(" @("!\(#$Q?" Q,GP@,31\(#$V?" Q XM.7P@,C!\"BLM+2TK+2TM*R @(" @(" @(" @(" @(" @(" @(" @(" @(" @ XM(" @(" @(" @("LM+2TK+2TM*RTM+2LM+2TK+2TM*RTM+2L*?#$Q('PQ,B!\ XM(" @(" @(" @(" @(" @(" @(" @(" @(" @(" @(" @(" @(" @?#$S('PQ XM-"!\,34@?#$V('PQ-R!\,3@@? I\3F$@?$UG('P@(" @(" @(" @(" @(" @ XM(" @(" @(" @(" @(" @(" @(" @("!\06P@?%-I('Q0("!\4R @?$-L('Q! XM<B!\"GP@,C-\(#(T?" @(" @(" @(" @(" @(" @(" @(" @(" @(" @(" @ XM(" @(" @('P@,C=\(#(X?" S,7P@,S)\(#,U?" T,'P**RTM+2LM+2TK+2TM XM*RTM+2LM+2TK+2TM*RTM+2LM+2TK+2TM*RTM+2LM+2TK+2TM*RTM+2LM+2TK XM+2TM*RTM+2LM+2TK+2TM*PI\,3D@?#(P('PR,2!\,C(@?#(S('PR-"!\,C4@ XM?#(V('PR-R!\,C@@?#(Y('PS,"!\,S$@?#,R('PS,R!\,S0@?#,U('PS-B!\ XM"GQ+("!\0V$@?%-C('Q4:2!\5B @?$-R('Q-;B!\1F4@?$-O('Q.:2!\0W4@ XM?%IN('Q'82!\1V4@?$%S('Q392!\0G(@?$MR('P*?" S.7P@-#!\(#0U?" T XM.'P@-3%\(#4R?" U-7P@-39\(#4Y?" U.7P@-C1\(#8U?" W,'P@-S-\(#<U XM?" W.7P@.#!\(#@T? HK+2TM*RTM+2LM+2TK+2TM*RTM+2LM+2TK+2TM*RTM XM+2LM+2TK+2TM*RTM+2LM+2TK+2TM*RTM+2LM+2TK+2TM*RTM+2LM+2TK"GPS XM-R!\,S@@?#,Y('PT,"!\-#$@?#0R('PT,R!\-#0@?#0U('PT-B!\-#<@?#0X XM('PT.2!\-3 @?#4Q('PU,B!\-3,@?#4T('P*?%)B('Q3<B!\62 @?%IR('Q. XM8B!\36\@?%1C('Q2=2!\4F@@?%!D('Q!9R!\0V0@?$EN('Q3;B!\4V(@?%1E XM('Q)("!\6&4@? I\(#@U?" X.'P@.#E\(#DQ?" Y,WP@.39\(#DY?#$P,7PQ XM,#-\,3 V?#$P.'PQ,3)\,3$U?#$Q.7PQ,C)\,3(X?#$R-WPQ,S%\"BLM+2TK XM+2TM*RTM+2LM+2TK+2TM*RTM+2LM+2TK+2TM*RTM+2LM+2TK+2TM*RTM+2LM XM+2TK+2TM*RTM+2LM+2TK+2TM*RTM+2L*?#4U('PU-B!\-3<@?#<R('PW,R!\ XM-S0@?#<U('PW-B!\-S<@?#<X('PW.2!\.# @?#@Q('PX,B!\.#,@?#@T('PX XM-2!\.#8@? I\0W,@?$)A('Q,82!\2&8@?%1A('Q7("!\4F4@?$]S('Q)<B!\ XM4'0@?$%U('Q(9R!\5&P@?%!B('Q":2!\4&\@?$%T('Q2;B!\"GPQ,S-\,3,W XM?#$S.7PQ-SA\,3@Q?#$X-'PQ.#9\,3DP?#$Y,GPQ.35\,3DW?#(P,7PR,#1\ XM,C W?#(P.7PR,#E\,C$P?#(R,GP**RTM+2LM+2TK+2TM*RTM+2LM+2TK+2TM XM*RTM+2LM+2TK+2TM*RTM+2LM+2TK+2TM*RTM+2LM+2TK+2TM*RTM+2LM+2TK XM+2TM*PI\.#<@?#@X('PX.2!\,3 T?#$P-7P@(" @(" @(" @(" @(" @(" @ XM(" @(" @(" @(" @(" @(" @(" @(" @(" @(" @(" @"GQ&<B!\4F$@?$%C XM('Q29B!\2&$@?" @(" @(" @(" @(" @(" @(" @(" @(" @(" @(" @(" @ XM(" @(" @(" @(" @(" @(" *?#(R,WPR,C9\,C(W?#(V,7PR-C!\(" @(" @ XM(" @(" @(" @(" @(" @(" @(" @(" @(" @(" @(" @(" @(" @(" @(" @ XM( HK+2TM*RTM+2LM+2TK+2TM*RTM+2L@(" @(" @(" @(" @(" @(" @(" @ XM(" @(" @(" @(" @(" @(" @(" @(" @(" @(" @"B @(" @(" @(" @(" @ XM(" @(" @(" @(" @(" @(" @(" @(" @(" @(" @(" @(" @(" @(" @(" @ XM(" @(" @(" @(" @(" *(" @(" @(" K+2TM*RTM+2LM+2TK+2TM*RTM+2LM XM+2TK+2TM*RTM+2LM+2TK+2TM*RTM+2LM+2TK+2TM*RTM+2L@(" @(" @( H@ XM(" @(" @('PU."!\-3D@?#8P('PV,2!\-C(@?#8S('PV-"!\-C4@?#8V('PV XM-R!\-C@@?#8Y('PW,"!\-S$@?" @(" @(" @"B @(" @(" @?$-E('Q0<B!\ XM3F0@?%!M('Q3;2!\174@?$=D('Q48B!\1'D@?$AO('Q%<B!\5&T@?%EB('Q, XM=2!\(" @(" @(" *(" @(" @("!\,30P?#$T,7PQ-#1\,30U?#$U,'PQ-3)\ XM,34W?#$U.7PQ-C)\,38U?#$V-WPQ-CE\,3<S?#$W-7P@(" @(" @( H@(" @ XM(" @("LM+2TK+2TM*RTM+2LM+2TK+2TM*RTM+2LM+2TK+2TM*RTM+2LM+2TK XM+2TM*RTM+2LM+2TK+2TM*R @(" @(" @"B @(" @(" @?#DP('PY,2!\.3(@ XM?#DS('PY-"!\.34@?#DV('PY-R!\.3@@?#DY('PQ,#!\,3 Q?#$P,GPQ,#-\ XM(" @(" @(" *(" @(" @("!\5&@@?%!A('Q5("!\3G @?%!U('Q!;2!\0VT@ XM?$)K('Q#9B!\17,@?$9M('Q-9"!\3F\@?$QR('P@(" @(" @( H@(" @(" @ XM('PR,S)\,C,Q?#(S.'PR,S=\,C0T?#(T,WPR-#=\,C0W?#(U,7PR-31\,C4W XM?#(U-GPR-31\,C4W?" @(" @(" @"B @(" @(" @*RTM+2LM+2TK+2TM*RTM XM+2LM+2TK+2TM*RTM+2LM+2TK+2TM*RTM+2LM+2TK+2TM*RTM+2LM+2TK(" @ X&(" @(" * X Xend //E*O*F ./1988/isaak.encode// echo x - ./1988/isaak.hint sed -e 's/^X//' > "./1988/isaak.hint" << '//E*O*F ./1988/isaak.hint//' XBest visuals: <imagen!isaak> Mark Isaak X X Mark Isaak X Imagen Corporation X 2650 San Tomas Expy. X Santa Clara, CA X 95052-8101 X USA X XCompile with: X X cc -DI=B -DO=- -Dy isaak.c -o isaak X XExecute without arguments. X XThe original entry starts with the line: X X main(){}; X XThis works on some 4.3BSD systems. Why? Note that #include <stdio.h> Xis given on the last line. Why is this needed? Note the unusual calls Xto sprintf. X XNOTE: The program relies heavily on ASCII. Don't even think of X running it on an EBCDIC machine. If you name the file anything X other than "isaak.c", you must change the #include on line 7. X XNOTE: The use of null comments to separate macros to construct different X tokens from a single macro (e.g., "O/**/O" creates either "++" or "--" X by defining "O" to be "+" or "-") may cause some strict ANSI X C preprocessors to object. X XNOTE: Most System V machines will not be able to execute this program X correctly due to the fact that BSD style systems have an sprintf() X that returns a char *. X XDue to the above problems, we have replaced the output of this program Xin the file: isaak.encode. To read this file do: X X uudecode < isaak.encode X cat isaak.output X XFYI: We are likely to be more strict about portability in the future. //E*O*F ./1988/isaak.hint// echo x - ./1988/litmaath.c sed -e 's/^X//' > "./1988/litmaath.c" << '//E*O*F ./1988/litmaath.c//' Xmain(argc, argv) Xint argc; Xchar **argv; X{ X while (*argv != argv[1] && (*argv = argv[1]) && (argc = 0) || (*++argv X && (**argv && ((++argc)[*argv] && (**argv <= argc[*argv] || X (**argv += argc[*argv] -= **argv = argc[*argv] - **argv)) && X --argv || putchar(**argv) && ++*argv--) || putchar(10)))) X ; X} //E*O*F ./1988/litmaath.c// echo x - ./1988/litmaath.hint sed -e 's/^X//' > "./1988/litmaath.hint" << '//E*O*F ./1988/litmaath.hint//' XBest small program: <cs.vu.nl!maart> Maarten Litmaath X X Maarten Litmaath X Free University (VU) Amsterdam X Department of computer science X Uilenstede 72 X 1183 AK Amstelveen X The Netherlands X XTry: litmaath eschew obfuscation X XNote the unusual structure: X X while (<condition>) X ; X XDid you notice that the body is empty? X XThe best one can do to understand how the program works is to give it Xtwo small strings as arguments, and follow the program closely. One Xcould make the body of the 'while' loop an 'fprintf' with interesting Xvariables like: X X fprintf(stderr, X "argv=%lo *argv=%lo **argv=%c argv[1]=%lo *argv[1]=%c argc=%d\n", X (long) argv, (long) *argv, *argv && **argv ? **argv : '@', X (long) argv[1], argv[1] && *argv[1] ? *argv[1] : '@', argc); X XFurthermore, it's interesting to note that only two variables are Xused to achieve everything. //E*O*F ./1988/litmaath.hint// echo x - ./1988/phillipps.c sed -e 's/^X//' > "./1988/phillipps.c" << '//E*O*F ./1988/phillipps.c//' Xmain(t,_,a ) Xchar X* Xa; X{ X return! X X0<t? Xt<3? X Xmain(-79,-13,a+ Xmain(-87,1-_, Xmain(-86, 0, a+1 ) X X X+a)): X X1, Xt<_? Xmain( t+1, _, a ) X:3, X Xmain ( -94, -27+t, a ) X&&t == 2 ?_ X<13 ? X Xmain ( 2, _+1, "%s %d %d\n" ) X X:9:16: Xt<0? Xt<-72? Xmain( _, t, X"@n'+,#'/*{}w+/w#cdnr/+,{}r/*de}+,/*{*+,/w{%+,/w#q#n+,/#{l+,/n{n+,/+#n+,/#;#q#n+,/+k#;*+,/'r :'d*'3,}{w+K w'K:'+}e#';dq#'l q#'+d'K#!/+k#;q#'r}eKK#}w'r}eKK{nl]'/#;#q#n'){)#}w'){){nl]'/+#n';d}rw' i;# ){nl]!/n{n#'; r{#w'r nc{nl]'/#{l,+'K {rw' iK{;[{nl]'/w#q#n'wk nw' iwk{KK{nl]!/w{%'l##w#' i; :{nl]'/*{q#'ld;r'}{nlwb!/*de}'c ;;{nl'-{}rw]'/+,}##'*}#nc,',#nw]'/+kd'+e}+;#'rdq#w! nr'/ ') }+}{rl#'{n' ')# }'+}##(!!/") X: Xt<-50? X_==*a ? Xputchar(31[a]): X Xmain(-65,_,a+1) X: Xmain((*a == '/') + t, _, a + 1 ) X: X X0<t? X Xmain ( 2, 2 , "%s") X:*a=='/'|| X Xmain(0, X Xmain(-61,*a, "!ek;dc i@bK'(q)-[w]*%n+r3#l,{}:\nuwloca-O;m .vpbks,fxntdCeghiry") X X,a+1);} //E*O*F ./1988/phillipps.c// echo x - ./1988/phillipps.hint sed -e 's/^X//' > "./1988/phillipps.hint" << '//E*O*F ./1988/phillipps.hint//' XLeast likely to compile successfully: <camcom!igp> Ian Phillipps X X Ian Phillipps X Cambridge Consultants Ltd X Science Park X Milton Road X Cambridge CB4 4DW X England X XCompile and run without parameters. X XThe program is smaller than even the 'compressed' form of its output, Xand thus represents a new departure in text compression standards. X XThe judges thought that this program looked like what you would get Xby pounding on the keys of an old typewriter at random. //E*O*F ./1988/phillipps.hint// echo x - ./1988/reddy.c sed -e 's/^X//' > "./1988/reddy.c" << '//E*O*F ./1988/reddy.c//' X#include<stdio.h> X#include<ctype.h> X#define w printf X#define p while X#define t(s) (W=T(s)) Xchar*X,*B,*L,I[99];M,W,V;D(){W==9?(w("`%.*s' is ",V,X),t(0)):W==40?(t(0),D(),t(41)):W==42?(t(0),D(),w("ptr to ")):0;p(W==40?(t(0),w("func returning "),t(41)):W==91?(t(0)==32?(w("array[0..%d] of ",atoi(X)-1),t(0)):w("array of "),t(93)):0);}main(){p(w("input: "),B=gets(I))if(t(0)==9)L=X,M=V,t(0),D(),w("%.*s.\n\n",M,L);}T(s){if(!s||s==W){p(*B==9||*B==32)B++;X=B;V=0;if(W=isalpha(*B)?9:isdigit(*B)?32:*B++)if(W<33)p(isalnum(*B))B++,V++;}return W;} //E*O*F ./1988/reddy.c// echo x - ./1988/reddy.hint sed -e 's/^X//' > "./1988/reddy.hint" << '//E*O*F ./1988/reddy.hint//' XMost useful Obfuscated C program: <> Gopi Reddy X X Amperif Corporation X 9232 Eton Avenue X Chatsworth, CA X 91311 X U.S.A. X X XCompile and give the following line as input: X X char *(*(fun[16])(); X XThis is a somewhat restricted version of a useful program that has been Xposted to Usenet. What is unusual is what it is able to do so much Xin such little space. //E*O*F ./1988/reddy.hint// echo x - ./1988/robison.c sed -e 's/^X//' > "./1988/robison.c" << '//E*O*F ./1988/robison.c//' X#include <stdio.h> Xunsigned char w,h,i,l,e,x,y=10,z=10,E[256]; X#define whi1e(j,k) printf(j,k); fflush(stdout) X#define o E[w] X Xmain (c,v) char *v[]; { Xwhile (c>=2 ){z = atoi(v[1]),--c; Xwhile (c>=2 )y = atoi(v[2]),--c;} Xwhi1e ("%s" ,"2."); Xwhile (--y) --x; Xwhile (--x) --e,--y; Xwhile (--z) --x; Xwhile (--x) --e,--z; Xwhile (--w) { Xwhile (--x) --o;} Xwhile (--z) { Xwhile (--x) --w; Xwhile (--o) ; Xwhile (--w) ; Xwhile (--e) --x; Xwhile (--x) --w,--e; Xwhile (--w) { Xwhile (--l) ; Xwhile (--i) --l;--l; Xwhile (--h) ; Xwhile (--y) --x; Xwhile (--x) --h,--y; Xwhile (--x) --h; Xwhile (--h) { Xwhile (--o) --x; Xwhile (--x) --l,--o; Xwhile (l>=w ){--i; Xwhile (--w) --l,--x; Xwhile (--x) --w;--l;}} Xwhile (--o) ; Xwhile (--l) --x; Xwhile (--x) --o;} Xwhile (--i) --h; Xwhi1e ("%x" ,--h);--e;} Xwhi1e ("%s" ,"\n");} //E*O*F ./1988/robison.c// echo x - ./1988/robison.hint sed -e 's/^X//' > "./1988/robison.hint" << '//E*O*F ./1988/robison.hint//' XBest abuse of C constructs: <robison@m.cs.uiuc.edu> Arch D. Robison X X Arch D. Robison X University of Illinois at Urbana-Champaign X 1304 W. Springfield Ave. X Urbana IL X 61801 X USA X XTry: robison 80 10 X robison 40 16 X XThe first and second parameters are optional. You might also try: X X robison 80 2 <--- can you find the bug? X robison 80 -246 X XThe author says: X X This program shows that C has many unnecessary constructs, in fact X only "while","--", and ">=" are required. (The two assignments at X the beginning could be avoided if "atoi" was rewritten with this X new paradigm.) Note that the lack of both the controversial "goto" X and assignment statements makes the meaning crystal clear. The current X ANSI committee should look into this practical simplification of C. X XThe following might make an interesting benchmark: X X robison 100 X X[Amdahl 5890-300E with System V cc: 8.40 seconds] X XWe suggest that you C preprocess and perhaps C-beautify this program. XAll is not what it may appear to be in this program. When does a whi1e Xnot take a while to execute? //E*O*F ./1988/robison.hint// echo x - ./1988/rules sed -e 's/^X//' > "./1988/rules" << '//E*O*F ./1988/rules//' XSubject: 5th International Obfuscated C Code Contest Rules XNewsgroups: comp.lang.c,comp.unix.wizards XKeywords: rules,1988,obfuscate,contest X X Obfuscate: tr.v. -cated, -cating, -cates. 1. a. To render obscure. X b. To darken. 2. To confuse: his emotions obfuscated his X judgement. [LLat. obfuscare, to darken : ob(intensive) + X Lat. fuscare, to darken < fuscus, dark.] -obfuscation n. X obfuscatory adj. X XGOALS OF THE CONTEST: X X * To write the most Obscure/Obfuscated C program under the rules below. X * To show what should NOT be done in C programs. X * To provide a safe forum for poor C code. :-) X XRULES: X X To help us handle the vast volume of entries, we ask that you X follow the rules below. Sorry for the length, but we need all X the help we can get! X X 1) Your source MUST be 1536 bytes or less, and it must be a complete X program, not just a subroutine. NOTE the new maximum size. X X 2) To help us process your entries, we ask that you submit entries X in the following format. Please be sure to include the --- lines, X otherwise our extraction program may skip your entry! X X---header items--- Xname: Your name, of course! Xorg: School/Company/Organization Xemail address: Email address from a well known site Xpostal address: Postal address, include your country as well Xenvironment: Indicate the Hardware & OS under which your program was tested Xentry: A of B <entry number such as 3 of 5, 1 of 1...> Xremarks: <see below> X---how to compile--- XX Give the command(s) needed to compile your program. XX Follow the same rules as given for the program below except that the XX command size must be 160 characters or less. X---program--- XX Place obfuscated source of 1536 characters or less in this section. XX Add a leading X to each line to avoid problems with mailers. XX Some mailers don't like files with very long lines. If your entry contains C XC lines longer 80 chars we ask you to form continuation line sets. To form C XC a continuation line set, place a 'C' character at the point of a split C XC and place a C (instead of an X) at the beginning of the next line. C XC Finally, end the continuation line set as normal. XX The C\nC's and leading X's will be removed prior to extraction and thus C XC they don't contribute toward the source character count. All other C XC characters are considered to be source. XX Newlines count as 1 character. Assume a standard 8 character tab stop. X---end--- X X 3) Regarding the header items: X X * Any text outside of the above format will be kept confidential. X X * All header lines are required, but you may use 'annonymous' X for any header line other than 'remarks' or 'entry'. X X * In the 'remarks' please include: X - what this program does X - why you think the program is obfuscated X - any other remarks you wish to make X X 4) Your entry should be written in common C. (K&R + common extensions) X Due to the lack of ANSI C compilers, it is suggested, but not X required, that you avoid use of constructs unque to ANSI C. X X 5) The program must be of original work. All programs must be X in the public domain. All copyrighted programs will be rejected. X X 6) Entries must be received between 15-Mar-88 0:00 GMT and X 25-May-88 0:00 GMT. Email your entries to: X X ...!amdahl!obfuscate X X Amdahl talks to hplabs, decwrl, pyramid, sun, uunet, cbosgd, ... X We will attempt to Email a confirmation of receipt of contest X entries, however since Email is not reliable you may not receive it. X People are strongly encouraged to submit entries via Email, however X one may mail entries the following postal address: X X Landon Curt Noll X Amdahl Corp. X 1250 E. Arques Ave. M/S 316 X P.O. Box 3470 X Sunnyvale, CA X 94088-3470 X U.S.A. X X Write the words: "International Obfuscated C Code Contest" near the X bottom left corner of the envelope. X X 7) Each person may submit up to 8 entries. Multiple entries must X be sent in separate Email letters or postal envelopes. X X XANNOUNCEMENT OF WINNERS: X X * First announcement will be at the Summer 88 Usenix BOF. X X * Winning entries will be posted to comp.sources.unix X as well as news groups where these rules were posted X in mid June 1988. (depending on the judges work load ;-}) X X * An article containing the winning entries will be published X in a future issue of the "Micro/Systems Journal". X X * Winners receive international fame and flames! :-) X X XJUDGING: X X Awards will be given to the best entry in a number of categories. X The actual category list will vary depending on the types of entries X we receive. As a guide, consider using the following: X X * The best small one line program X * The most obscure algorithm X * The strangest source layout X * The most useful obfuscated program X * The most creatively obfuscated program X * Best obfuscated entry smaller than 256 bytes X * Best obfuscated entry smaller than 1024 bytes X * <anything else so strange that it deserves an award> X XPOINTS TO PONDER: X X People are encouraged to examine winners of the previous contests. A X copy of these entries was posted to comp.sources.unix on or about X 15-Mar-88. Contact the comp.sources.unix moderator, or some archive X site if you missed that posting. Keep in mind that rules change from X year to year, so some winning entries may not be valid entries this X year. What was unique and novel one year might be 'old' the next X year. In short, use your best judgement. X X We examine each entry on several levels of confusion. For example X each entry is judged when we: X X * look at the original source X * run it through; sed -e ',^#[ ]*define,d' | /lib/cpp X * run it through a C beautifier X * examine the algorithm X * compile and lint it X * execute it X X One line programs are best when they are short, obscure and concise. X X We tend to dislike programs that: X X * are very hardware specific X * are very OS or Un*x version specific X (index/strchr differences are ok, but X socket/streams specific code is likely not to be) X * dump core or have compiler warnings X (it is ok only if you warn us in the 'remark' header item) X * won't compile under both BSD or SYS V Un*x X * use an excessively long compile line to get around the X size limit X * are longer than they need to be X * are similar to previous winners X * are similar to previous losers :-) X X Simply abusing #defines or -Dfoo=bar won't go as far as a program X that is more well rounded in confusion. X X Unless you are crampt for space, or unless you are entering the X 'best one liner' category, we suggest that you format your program X in a more creative way than simply forming excessively long lines. X X We like programs that: X X * are as concise and small as they need to be X * do something quasi-interesting X * pass lint without complaint X * are portable X * are unique or novel in their obfuscation style X * use a number of different types of obfuscation X * make us laugh and/or throw up :-) X X Some types of programs can't excel in some areas. We try to account X for this by giving awards to programs in a number of areas. Of course, X your program doesn't have to excel in all areas, but doing well in a X few helps. X X Be creative! X X The Judging will be done by Landon Noll and Larry Bassel. If you have X any QUESTIONS or COMMENTS, please feel free to send them to: X X ...!amdahl!judges X X however contest entries should be sent to: X X ...!amdahl!obfuscate X X Xchongo <Landon Curt Noll> /\cc/\ {decwrl,sun,uunet}!amdahl!chongo XLarry Bassel {amdahl,ucbvax,cbosgd}|sun!lab X Xp.s. The 1988 contest has been dedicated to Bill the Cat. |\_.^ X (@ o) X *Ackpt!* {:} X U //E*O*F ./1988/rules// echo x - ./1988/spinellis.c sed -e 's/^X//' > "./1988/spinellis.c" << '//E*O*F ./1988/spinellis.c//' X#include "/dev/tty" //E*O*F ./1988/spinellis.c// echo x - ./1988/spinellis.data sed -e 's/^X//' > "./1988/spinellis.data" << '//E*O*F ./1988/spinellis.data//' Xmain() X{ X printf("Hello world\n"); X} //E*O*F ./1988/spinellis.data// echo x - ./1988/spinellis.hint sed -e 's/^X//' > "./1988/spinellis.hint" << '//E*O*F ./1988/spinellis.hint//' XBest abuse of the rules: <cc.ic.ac.uk!dds> Diomidis Spinellis X X Diomidis Spinellis (currently at Imperial College, London, England) X 1 Myrsinis Str. X GR-145 62 Kifissia X GREECE X XHow to compile: X X /lib/cpp spinellis.c > spin.c X Xand type the following text followed by an EOF ('^D'): X X main() X { X printf("Hello world\n"); X } X XThe author says: X X This program can be configured to do almost everything. X The configuration is done during compile time by typing X in, C code, that one would like the program to perform. X A trivial example is given in the `how to compile' section X but the possibilities are clearly limited only by your X imagination and programming skills. X XFYI: We enjoyed this entry this year, however in the future programs X must be able to be compiled from within a makefile without the X need of human intervention. //E*O*F ./1988/spinellis.hint// echo x - ./1988/westley.c sed -e 's/^X//' > "./1988/westley.c" << '//E*O*F ./1988/westley.c//' X#define _ -F<00||--F-OO--; Xint F=00,OO=00;main(){F_OO();printf("%1.3f\n",4.*-F/OO/OO);}F_OO() X{ X _-_-_-_ X _-_-_-_-_-_-_-_-_ X _-_-_-_-_-_-_-_-_-_-_-_ X _-_-_-_-_-_-_-_-_-_-_-_-_-_ X _-_-_-_-_-_-_-_-_-_-_-_-_-_-_ X _-_-_-_-_-_-_-_-_-_-_-_-_-_-_ X_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_ X_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_ X_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_ X_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_ X _-_-_-_-_-_-_-_-_-_-_-_-_-_-_ X _-_-_-_-_-_-_-_-_-_-_-_-_-_-_ X _-_-_-_-_-_-_-_-_-_-_-_-_-_ X _-_-_-_-_-_-_-_-_-_-_-_ X _-_-_-_-_-_-_-_ X _-_-_-_ X} //E*O*F ./1988/westley.c// echo x - ./1988/westley.hint sed -e 's/^X//' > "./1988/westley.hint" << '//E*O*F ./1988/westley.hint//' XBest layout: <rose3!merlyn> Brian Westley X X Merlyn LeRoy (Brian Westley) X Rosemount, Inc. X 1121 Hamline Ave. N. #17 X St. Paul, MN X 55108 X U.S.A. X XCompile and execute without arguments. X XNote: Your compiler must parse X X #define _ -a X -_ X X as "--a" and not "-(-a)" or some other tokenized form. Some strictly X conforming ANSI C Preprocessors may object to this. X XYou might enjoy looking at the output of: X X cc -E westley.c //E*O*F ./1988/westley.hint// echo x - ./1988/zsmall.c sed -e 's/^X//' > "./1988/zsmall.c" << '//E*O*F ./1988/zsmall.c//' X#ifdef a X#undef a X#ifdef b X#undef b X#ifdef c X#undef c X#ifdef e X#undef e X#ifdef f X#undef f X#ifdef g X#undef g X#ifdef h X#undef h X#ifdef i X#undef i X#ifdef j X#undef j X#ifdef k X#undef k X#else X#define k X#endif X#else X#define j X#endif X#else X#define i X#endif X#else X#define h X#endif X#else X#define g X#endif X#else X#define f X#endif X#else X#define e X#endif X#else X#define c X#endif X#else X#define b X#endif X#else X#define a X#endif X#ifdef k X#define p (1<<7) X#else X#define p 0 X#endif X#ifdef j X#define q (1<<6) X#else X#define q 0 X#endif X#ifdef i X#define r (1<<5) X#else X#define r 0 X#endif X#ifdef h X#define s (1<<4) X#else X#define s 0 X#endif X#ifdef g X#define t (1<<3) X#else X#define t 0 X#endif X#ifdef f X#define u (1<<2) X#else X#define u 0 X#endif X#ifdef e X#define v (1<<1) X#else X#define v 0 X#endif X#define vv (p+q+r+s+t+u+v+1) X#define ff \ X (defined(c)*8+defined(b)*4+defined(a)*2+1) X#if vv==1 X#undef vv X#define vv 2 X#endif X#if ff<vv X#if ff!=1 X#if (vv/ff)*ff==vv X#ifndef dd X#define dd X#endif X#endif X#endif X#endif X#if ff==15 X#ifdef dd X#undef dd X#else Xprintf("%d\n", vv); X#endif X#endif X#undef ff X#undef vv X#undef p X#undef q X#undef r X#undef s X#undef t X#undef u X#undef v X#ifdef w X#ifdef x X#ifdef y X#ifndef z X#define z X#endif X#else X#define y X#endif X#else X#define x X#endif X#else X#define w X#include <stdio.h> Xmain(){ X#endif X#ifndef z X#include "zsmall.c" X#include "zsmall.c" X#include "zsmall.c" X#include "zsmall.c" X#include "zsmall.c" X#include "zsmall.c" X#include "zsmall.c" X#include "zsmall.c" X#endif X#ifdef z X#undef z X#else X#ifdef y X#undef y X#else X#ifdef x X#undef x X#else X#ifdef w X#undef w X} X#endif X#endif X#endif X#endif //E*O*F ./1988/zsmall.c// echo Possible errors detected by \'wc\' [hopefully none]: temp=/tmp/shar$$ trap "rm -f $temp; exit" 0 1 2 3 15 cat > $temp <<\!!! 80 437 2607 Makefile 17 137 842 README 193 323 838 applin.c 28 190 1095 applin.hint 26 63 796 dale.c 17 73 475 dale.hint 34 71 1006 isaak.c 68 435 4007 isaak.encode 43 210 1295 isaak.hint 10 49 305 litmaath.c 30 124 866 litmaath.hint 53 102 877 phillipps.c 16 71 464 phillipps.hint 6 24 537 reddy.c 16 59 353 reddy.hint 40 123 789 robison.c 35 171 1108 robison.hint 207 1272 7713 rules 1 2 20 spinellis.c 4 5 37 spinellis.data 30 129 865 spinellis.hint 20 23 555 westley.c 22 66 440 westley.hint 160 277 1585 zsmall.c 1156 4436 29475 total !!! wc ./1988/Makefile ./1988/README ./1988/applin.c ./1988/applin.hint ./1988/dale.c ./1988/dale.hint ./1988/isaak.c ./1988/isaak.encode ./1988/isaak.hint ./1988/litmaath.c ./1988/litmaath.hint ./1988/phillipps.c ./1988/phillipps.hint ./1988/reddy.c ./1988/reddy.hint ./1988/robison.c ./1988/robison.hint ./1988/rules ./1988/spinellis.c ./1988/spinellis.data ./1988/spinellis.hint ./1988/westley.c ./1988/westley.hint ./1988/zsmall.c | sed 's=[^ ]*/==' | diff -b $temp - exit 0 -- [views above shouldn't be viewed as Amdahl views, or as views from Amdahl, or as Amdahl views views, or as views by Mr. Amdahl, or as views from his house]