v14i002: International Obfuscated C Code Contest, Part02/05

Rich Salz rsalz at bbn.com
Wed Mar 16 11:01:50 AEST 1988


Submitted-by: Landon Curt Noll <chongo at uts.amdahl.com>
Posting-number: Volume 14, Issue 2
Archive-name: ioccc/part02

# 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.  If anybody has a copy of
Xthe rules for 1984, please Email it to: chongo at amdahl.com.
//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 the 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 my 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  for(signal=0;*k * x * __FILE__ *i;) do {
Xto:
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
Xthen from:
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]
Xto:
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
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
Xinstructions.  Not only that, Vax-11's can run this program due to
XPDP-11 emulation mode!  (you call that portable?)  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//'
XThe 1984 rules were never kept, unless someone has a good archive out there!
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
      7     63    385 README
      2      4    123 anonymous.c
      8     66    383 anonymous.hint
     32     77    509 decot.c
     14     61    369 decot.hint
     12     62    510 laman.c
     19     76    497 laman.hint
     10     86    431 mullender.c
     22    187   1134 mullender.hint
      5     41    248 rules
    156    778   4920 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

-- 
Please send comp.sources.unix-related mail to rsalz at uunet.uu.net.



More information about the Comp.sources.unix mailing list