Game Programming and Development Tools

International obfuscated c code competition – spade89

spade89

Member

Posts: 561
From: houston,tx
Registered: 11-28-2006
incase you c code monkeys don't already know every year there is an international obfuscated c code competition. the whole point of this competition is making the most unreadable obfuscated c code you can,and the amount of obfuscation is startling,who knew c code could be more unreadable than it already is, anyways here is the link to the site:
http://www.ioccc.org/

but what caught me by real surprise was a writer accidentaly winning this compettition: http://www.slashnot.com/articles/572/

and i wondered is my code readable to other coders or just me?and i wondered if other programmers have similar problems?so do you think your code is readable ?or it really doesn't matter whether it is readable or not? if readability is important then what makes a code clean and readable?

------------------
Matthew(22:36-40)"Teacher, which is the greatest commandment in the Law?" Jesus replied: " 'Love the Lord your God with all your heart and with all your soul and with all your mind. This is the first and greatest commandment. And the second is like it: 'Love your neighbor as yourself.All the Law and the Prophets hang on these two commandments."
Whose Son Is the Christ

HanClinto

Administrator

Posts: 1828
From: Indiana
Registered: 10-11-2004
Spade, you totally almost had me fooled with that "accidental winner" article. It took me a little while before I realized that it wasn't a real Slashdot article.

Nice one.

--clint

samw3

Member

Posts: 542
From: Toccoa, GA, USA
Registered: 08-15-2006
Hilarious! My fave obfuscated code... DVD Encryption cracked in six lines of code. Some say its obfuscation.. some just say its perl

s''$/=\2048;while(<> ){G=29;R=142;if((@a=unqT="C*",_)[20]&48){D=89;_=unqb24,qT,@
b=map{ord qB8,unqb8,qT,_^$a[--D]}@INC;s/...$/1$&/;Q=unqV,qb25,_;H=73;O=$b[4]<<9
|256|$b[3];Q=Q>>8^(P=(E=255)&(Q>>12^Q>>4^Q/8^Q))<<17,O=O>>8^(E&(F=(S=O>>14&7^O)
^S*8^S<<6))<<9,_=(map{U=_%16orE^=R^=110&(S=(unqT,"\xb\ntd\xbz\x14d")[_/16%8]);E
^=(72,@z=(64,72,G^=12*(U-2?0:S&17)),H^=_%64?12:0,@z)[_%8]}(16..271))[_]^((D>>=8
)+=P+(~F&E))for@a[128..$#a]}print+qT,@a}';s/[D-HO-U_]/\$$&/g;s/q/pack+/g;eval

------------------
Sam Washburn

TwoBrothersSoftware

Member

Posts: 141
From: Janesville, Wi USA`
Registered: 08-05-2006
quote:
Originally posted by samw3:
Hilarious! My fave obfuscated code... DVD Encryption cracked in six lines of code. Some say its obfuscation.. some just say its perl

s''$/=\2048;while(<> ){G=29;R=142;if((@a=unqT="C*",_)[20]&48){D=89;_=unqb24,qT,@
b=map{ord qB8,unqb8,qT,_^$a[--D]}@INC;s/...$/1$&/;Q=unqV,qb25,_;H=73;O=$b[4]<<9
|256|$b[3];Q=Q>>8^(P=(E=255)&(Q>>12^Q>>4^Q/8^Q))<<17,O=O>>8^(E&(F=(S=O>>14&7^O)
^S*8^S<<6))<<9,_=(map{U=_%16orE^=R^=110&(S=(unqT,"\xb\ntd\xbz\x14d")[_/16%8]);E
^=(72,@z=(64,72,G^=12*(U-2?0:S&17)),H^=_%64?12:0,@z)[_%8]}(16..271))[_]^((D>>=8
)+=P+(~F&E))for@a[128..$#a]}print+qT,@a}';s/[D-HO-U_]/\$$&/g;s/q/pack+/g;eval



But isn't obfuscated and Perl a redundant statement

Although I don't code in Perl so I don't know first hand

samw3

Member

Posts: 542
From: Toccoa, GA, USA
Registered: 08-15-2006
Well.. diehard perl coders would say that programming was supposed to be that way. But, believe it or not, I have actually witnessed structured programming in perl..though not frequently.

------------------
Sam Washburn

spade89

Member

Posts: 561
From: houston,tx
Registered: 11-28-2006
i just read about this past ioccc winner code i didn't try it but here it is anyways:
main(){printf(&unix["\021%six\012\0"],(unix) ["have"]+"fun"-0x60;}
and another one i also read but didn't try is suppose to be a trilingual program that compiles in c,c++ and java :

#define String char*
#define t struct
#include<stdio.h>
t{t{int(*print)(const char *,...);}out;}
System={{printf}};/*\u002a\u002f
public class b{
public static void
main(
int argc,String argv[])
{System.out.print("Hi!\n");
}
/*\u002a\u002f}/**/

my favorite ioccc winner would be this one:

http://www.au.ioccc.org/2004/newbern.orig.c

i was going to post it here but the ccn server wouldn't let me i guess the code is too obfuscated.
------------------
<B>
Matthew(22:36-40)"Teacher, which is the greatest commandment in the Law?" Jesus replied: " 'Love the Lord your God with all your heart and with all your soul and with all your mind. This is the first and greatest commandment. And the second is like it: 'Love your neighbor as yourself.All the Law and the Prophets hang on these two commandments."
Whose Son Is the Christ

[This message has been edited by spade89 (edited January 07, 2007).]

samw3

Member

Posts: 542
From: Toccoa, GA, USA
Registered: 08-15-2006
haha.. cute..
The \u002a\u002f are the unicode form of the characters */ which ends the comment and allows it to compile in java.

------------------
Sam Washburn