Slashdot Mirror


18th International Obfuscated C Code Contest Opens

chongo writes "The 18th International Obfuscated C Code Contest, the Internet's longest running contest, is now open. The goals, rules, and guidelines are available. Use the online submission tool to submit your obfuscated C code by 22-May-2005 23:59:59 UTC."

56 of 187 comments (clear)

  1. Past Winners with Spoilers by Entropy248 · · Score: 5, Informative

    Here are some past winners with "Spoilers" for what they do. It's already pretty slow though and I'm first post.

    1. Re:Past Winners with Spoilers by mirko · · Score: 2, Interesting
      My personal favorite is the following:
      http://remus.rutgers.edu/~rhoads/Obfuscated_C/hagu e


      It's a command line based ascii to morse converter...
      I especially like the fact it's a bunch of DAH DAHDIT!
      --
      Trolling using another account since 2005.
    2. Re:Past Winners with Spoilers by aliasptr · · Score: 2, Interesting

      After running arg.c (just a file with the original source code in it) through the preprocessor and some indentation:

      # 1 "arg.c"
      # 1 ""
      # 1 ""
      # 1 "arg.c"
      # 9 "arg.c"
      char _DAH_[]="ETIANMSURWDKGOHVFaLaPJBXCYZQb54a3d2f16g7c 8a90l?e'b.s;i,d:";
      main ( )
      {
      char * _DIT,* DAH_,* DIT_,* _DIT_,* malloc (),* gets ( );

      for ( _DIT=malloc ( 81 ),DIT_=_DIT++;_DIT== gets ( _DIT );__DIT('\n') )
      for ( DAH_=_DIT; *DAH_; __DIT ( *_DIT_?_DAH ( * DIT_ ):'?'),__DIT(' '),DAH_ ++ )
      for (* DIT_=2,_DIT_=_DAH_; * _DIT_ && (* _DIT_!=( * DAH_>='a'? *DAH_&223:* DAH_ ) ); (* DIT_ ) ++,_DIT_ ++ )
      * DIT_+= ( * _DIT_>='a'? * _DIT_-'a':0);
      }_DAH
      ( DIT_ )
      {__DIT
      (DIT_>3?_DAH ( DIT_>>1 ):'\0');
      return DIT_&1?'-':'.';
      }__DIT
      ( DIT_ ) char DIT_;

      {
      ( void ) write ( 1,&DIT_,1 );
      }

      (arg.c is just the original source file)

      And there you have it. As mentioned on the page the similar names are annoyingly hard to read, ternary operator usage, weird function exits (I think I am not very good with C... corrections or resources about what exactly is going on with {__DIT ... }__DIT? Or perhaps some Google searching :-P . I had wasted my time making this so I figured I'd post it.

      --
      It takes all types in this world. I sincerely mean it... This is just my perspective.
  2. Reminds me of a joke... by mirko · · Score: 5, Funny
    The highlight of the annual Computer Bowl occurred when Bill Gates, who was a judge, posed the following question to the contestants:

    ``What contest, held via Usenet, is dedicated to examples of weird, obscure, bizarre, and really bad programming?''

    After a moment of silence, Jean-Louis Gassee (ex-honcho at Apple) hit his buzzer and answered ``Windows.''

    Mr. Bill's expression was, in the words of one who was there, ``classic.''
    --
    Trolling using another account since 2005.
    1. Re:Reminds me of a joke... by Pastis · · Score: 2, Informative

      2 things:

      - this was I think in 1993 and Gassiee has been more famous since by being the man behind BeOS.

      - this was on TV. we NEED to find that episode...
      It apparently is not in these archives: http://www.archive.org/movies/movieslisting-browse .php?collection=computerchronicles&cat=computer%20 bowl&PHPSESSID=afa9787e38cc81e4f22ed0542058072a

      Anyone with it? Maybe Mr Gassiee has it :)

    2. Re:Reminds me of a joke... by Rufus211 · · Score: 2

      Google Search: CtrlAltDel.asf

      all the links to andrew.cmu are dead as I've removed the video from my webspace, but there are plenty of copies floating around.

    3. Re:Reminds me of a joke... by Anonymous Coward · · Score: 3, Informative
  3. Our Legacy code by AhaIndia · · Score: 5, Funny

    The legacy code I have to work on must be submitted. No body knows how it works and there is no documentation.

    --
    ~Aha~
    1. Re:Our Legacy code by Anonymous Coward · · Score: 2, Funny
      No body knows how it works and there is no documentation.
      Oh, so you're the one who is developing OpenSSL's libcrypto.
  4. Re:Rawr by 0x461FAB0BD7D2 · · Score: 3, Funny

    Line 20 will never execute unless you return from Hell. Yes, Jesus, I mean you.

  5. Re:Rawr by JesusCigarettes · · Score: 2, Funny

    Hey, don't bring me into this!

    Besides, if Keanu Reeves can do it, anyone can.

  6. Hmm.. by bl4nk · · Score: 5, Funny

    DOS C:\DOS C:\DOS\RUN RUN DOS RUN.. Wait... that's C isn't it? God damn it. I'll never win at this rate...

  7. Mirrors by ugo · · Score: 5, Informative

    www.tw.ioccc.org - Hsin-Chu, Taiwan
    www.au.ioccc.org - Sydney, Australia
    www.de.ioccc.org - Frankfurt/Main, Germany
    www.es.ioccc.org - Madrid, Spain
    www.gr.ioccc.org - Athens, Greece
    www0.us.ioccc.org - Sunnyvale California, US
    www1.us.ioccc.org - Saint Paul, Minnesota US

  8. I wonder... by slobber · · Score: 3, Interesting

    is there a similar contest for Perl? I imagine much crazier submissions with Perl than what can be done with C (no offense to C programmers ;))

    --
    "You mortals are so obtuse." -Q
    1. Re:I wonder... by Anonymous Coward · · Score: 5, Funny

      No, they have the UNobfuscated version of the event for Perl - much harder to win.

      http://humorix.org/articles/2000/09/unobfuscated /

    2. Re:I wonder... by Electroly · · Score: 4, Funny

      Obfuscated Perl? Contests are supposed to be hard. :-)

    3. Re:I wonder... by Ryvar · · Score: 4, Funny

      Obfuscated Perl? Contests are supposed to be hard. :-)

      Oh, it would be hard, just not in the way you think. If none of the judges can figure out any of the entries, how would they be able to pick a winner?

      --Ryv

    4. Re:I wonder... by Crspe · · Score: 5, Interesting

      Well, there is kind of a similar competition for perl ... perl golf ... where the aim is to write the smallest possible perl program to fulfill a particular task. The winners of these competitions are invariably amazingly obfuscated, and unbelievably small!
      One example - one competition involved calculating and printing out the huffman codes for a given input - the winner achieved this with a 76 character perl program!

      find more here:
      http://www.google.com/search?hl=en&q=perl+golf
      or here http://terje.perlgolf.org/

    5. Re:I wonder... by Procrasti · · Score: 2, Funny

      You know why there is no obfuscated Perl contest?

      Everyone's a winner!

    6. Re:I wonder... by downbad · · Score: 3, Informative

      They could run it through Perl and look at the optimized syntax tree it generates, but I suspect that's outside most hackers' repertoires.

    7. Re:I wonder... by Ohreally_factor · · Score: 2
      I never realized that
      $_=$/++
      was Perl. I always thought it was an emoticon representing the JFK assassination.
      --
      It's not offtopic, dumbass. It's orthogonal.
  9. Quoth the output, "I've dumped a core" by aendeuryu · · Score: 5, Funny

    Once upon a midnight dreary, gcc compiled, growing weak and weary,
    code obfuscated like ne'er seen before.
    I could hear a faint grinding,
    As the preprocessor went on finding,
    it was a noise I could plainly say I abhor.
    T'was an executable destined to dump quite a core.

    It was a nice sunny day, I remember, in May,
    and there lay pizza boxes scattered all o'er the floor.
    But because of this Gentoo, I felt I was being sent to
    the depths of hell for damnation evermore.
    All for a program that would dump its core.

    In time, day diminished, and gcc was finished,
    and the program was a size worthy of lore,
    because of the a.out, my hard drive near ran out,
    as the program took up gigabytes galore,
    and when I ran it, quoth the output, "I've just dumped a core."

  10. Maze of Code by Anonymous Coward · · Score: 5, Interesting

    Compile with -fwritable-strings, run, type in a number like 20, find your way out...

    char*M,A,Z,E=40,J[40],T[40];main(C){for( *J=A=scanf(M="%d",&C);
    -- E; J[ E] =T
    [E ]= E) printf("._"); for(;(A-=Z=!Z) || (printf("\n|"
    ) , A = 39 ,C --
    ) ; Z || printf (M ))M[Z]=Z[A-(E =A[J-Z])&&!C
    & A == T[ A]
    |6<<27<rand()||!C&!Z?J[T[E]=T[A]]=E,J[T[A]=A-Z ]=A,"_.":" |"];}

    1. Re:Maze of Code by Speare · · Score: 3, Informative
      This was one of my favorite ObC programs from the distant past. Did you notice that the first variables spell MAZE? Did you notice the code is a maze? Did you notice the passages of the maze spell MAZE? A proper ObC entry is not just obfuscated, but is an onion of beautifully expressed multiple messages.

      There's another one in which the program is shaped like a sailor's semaphore, and produces stick-figure cartoons of a sailor waving semaphores to spell out a user-supplied message.

      --
      [ .sig file not found ]
  11. Speaking of obfuscated code... by PornMaster · · Score: 5, Informative

    If you haven't been there yet, you should check out TheDailyWTF... it's not obfuscated code, but rather unmaintainable code people submit to show what they've been left to deal with at work. Quite interesting, and sometimes as difficult to understand as intentionally obfuscated code.

    1. Re:Speaking of obfuscated code... by Repton · · Score: 5, Funny

      This truly brings tears to my eyes...

      public boolean compareObjects(Object obj1 , Object obj2) {
      if (obj1.equals(obj2) == true)
      return true;
      else
      return false;
      }

      Oh why aren't we teaching more people to code like this?

      --
      Repton.
      They say that only an experienced wizard can do the tengu shuffle.
    2. Re:Speaking of obfuscated code... by sconeu · · Score: 4, Funny

      Reminds me of some code... it was in a military system...


      while (strncmp(p," ", 1) == 0)
      ++p;


      To find the first non-space character in a string.

      --
      General Relativity: Space-time tells matter where to go; Matter tells space-time what shape to be.
    3. Re:Speaking of obfuscated code... by scavenger87 · · Score: 2, Funny
      Can somebody enlighten a newbie what is wrong with parent's code? Is the following snippet better:
      public boolean compareObjects(Object obj1,Object obj2) {
      return obj1.equals(obj2);
      }
  12. Imawhore by Kethinov · · Score: 4, Informative
    Google cache of the main page: http://64.233.167.104/search?q=cache:QecdG73oJ2cJ: www.ioccc.org/main.html+The+International+Obfuscat ed+C+Code+Contest&hl=en&client=firefox-a

    Full text of rules.txt

    18th International Obfuscated C Code Contest Rules

    Copyright (C) 2005 Leonid A. Broukhis, Simon Cooper, Landon Curt Noll and
    Peter Seebach.

    All Rights Reserved. Permission for personal, education or non-profit use is
    granted provided this this copyright and notice are included in its entirety
    and remains unaltered. All other uses must receive prior permission in
    writing from the contest judges.

    Obfuscate: tr.v. -cated, -cating, -cates. 1. a. To render obscure.
    b. To darken. 2. To confuse: his emotions obfuscated his
    judgment. [LLat. obfuscare, to darken : ob(intensive) +
    Lat. fuscare, to darken < fuscus, dark.] -obfuscation n.
    obfuscatory adj.

    GOALS OF THE CONTEST:

    * To write the most Obscure/Obfuscated C program under the rules below.
    * To show the importance of programming style, in an ironic way.
    * To stress C compilers with unusual code.
    * To illustrate some of the subtleties of the C language.
    * To provide a safe forum for poor C code. :-)

    The 18th IOCCC contest window is:

    | 21-Mar-2005 00:00 UTC to 22-May-2005 23:59:59 UTC

    RULES:

    To help us with the volume of entries, we ask that you follow these rules:

    1) Your entry must be a complete program.

    2) The size of your program source must be <= 4096 bytes in length.
    The number of characters excluding whitespace (tab, space,
    newline, formfeed, return), and excluding any ; { or } immediately
    followed by whitespace or end of file, must be <= 2048.

    3) Submissions should be performed using the instructions outlined at,

    | http://www.ioccc.org/2005/submit

    4) If your entry is selected as a winner, it will be modified as follows:

    Your 'build' instructions will be incorporated into a
    makefile. If your build instructions *is* a makefile then
    it should be portable and usable from within a master
    makefile.

    Your program source will be renamed using an identifier of
    our choice (usually your family name or anonymous) followed
    by an optional digit, followed by '.c'

    Your entry will be compiled into a file with the above name
    minus the '.c'.

    If your entry requires that a build file exist, state so in
    your entry's remark section. The makefile will be arranged to
    execute a build shell script containing the 'build'
    information. The name of this build shell script will be your
    entry's title, possibly followed by a digit, followed by '.sh'.

    If needed, your entry's remarks should indicate how your entry
    must be changed in order to deal with the new filenames.

    5) The build file, the source and the resulting executable should be
    treated as read-only files. If your entry needs to modify these files,
    it should make and modify a copy of the appropriate file. If this
    occurs, state so in your entry's remarks.

    6) Your program source must be able to be compiled cleanly by an ANSI C
    compiler, or if there are any compile errors, they must be documented
    in the "remarks" section of your submission.

    7) The program must be of original work. All submitted programs are
    are thereby put in the public domain. All explic

    --
    You're right, I wouldn't steal a car. But if it were possible, I sure as hell would download one!
  13. Apologies Mr Watterson: by sshtome · · Score: 3, Insightful

    "With a little practice, language can become a complete impediment to understanding"

  14. That pink stuff on the walls... by fm6 · · Score: 3, Funny
    ...is from all the brains that exploded as they tried to grasp that code.

    But what's the point? Why expend all that effort on obfuscating code when there are languages with obfuscation already built in?

  15. Ode to C. by Anonymous Coward · · Score: 5, Funny

    May your signals all trap
    May your references be bounded
    All memory aligned
    Floats to ints rounded

    Remember ...

    Non-zero is true
    ++ adds one
    Arrays start with zero
    And NULL is for none

    For octal, use zero
    0x means hex
    = will set
    == means test

    use -> for a pointer
    a dot if its not
    ? : is confusing
    use them a lot

    a.out is your program
    there's no U in foobar
    And char (*(*x())[])() is a function returning a pointer to an array of pointers to functions returning char.

  16. Not many languages could have such a contest by Anonymous Coward · · Score: 4, Insightful
    It does say something about the joy and beauty of C that such a contest is even possible. It says something about "learning from their mistakes" that you couldn't even have a contest like this in Java. You just can't write a valid Java file that is obfuscated to such an extent. A large part of it is that Java has no pointers and everything has to exist within a class.

    Wasn't there some kind of obfuscated vote counting software contest announced before the recent US election? I would like to see some of the entrants into that.

  17. Re:Grr by Rattencremesuppe · · Score: 2, Informative
    Stupid HTML that ignores white space. It looks kinda cool in the source of the page.
    Use <ecode>
  18. A tattoo of obfuscated C ... by Crspe · · Score: 5, Interesting

    This I love - One guy went and had the first ever entry in the ioccc (from 1984) tattooed on his forearm ...
    http://tattoo.thomasscovell.com/index.html

    This I also love - the first ever entry was a hello world program!

    That entry was the longest one ever made into a tattoo, however there are hundreds of people around the world who have unknowingly had this entry tattoed on their forearm:
    http://www.de.ioccc.org/years.html#1994_smr

    This is really a great competition - lots of fun, lots to learn. Try understanding how some of the entries work, its really a challenge sometimes, and you can learn plenty about C and the preprocessor.

  19. Re:Oh. My. God. by Rattencremesuppe · · Score: 3, Funny
    Am I the only that thinks that perhaps the programmers of the world can spend their energies doing something a little...um...i dunno...um...productive?

    Like... posting on Slashdot?

  20. That would be a good joke if Windows were... by Anonymous Coward · · Score: 3, Insightful

    a) a contest

    b) held via Usenet.

  21. I agree with you. Join us. Join us. by kahei · · Score: 5, Funny


    Unproductive labor is bad. Only productive units can be allowed in hive. Workers who waste energy must be sent to the vats. It is therefore in interests of workers to be productive. To conserve energy. To obey.

    (This message brought to you by the World Utilitarian Council).

    --
    Whence? Hence. Whither? Thither.
  22. Too right! by SweetAndSourJesus · · Score: 3, Funny

    As we all know, programming and fun are mutually exclusive. It's completely inconceivable that someone might have, I don't know, a good time writing code.

    --

    --
    the strongest word is still the word "free"
  23. Yes by AthenianGadfly · · Score: 5, Funny

    Yes, they do have this in Perl. It's called programming.

  24. I've got a good one in the same vein by Anonymous Coward · · Score: 5, Funny

    B: Why did the chicken cross the road?

    A: Windows sucks!

    1. Re:I've got a good one in the same vein by Anonymous Coward · · Score: 5, Funny

      B: Windows NT Chicken:
      A: The Windows NT Chicken is designed to run over the Novell chicken as it crosses the road. Forget about crossing the road with less than 100MB of RAM

      B: Win 95 Chicken:
      A: The Win95 Chicken can cross any given road in eleven different ways, not counting the use of wizards who will actually cross the road for the chicken. If you can remember all eleven ways, you can become a Microsoft Certified Poultry Specialist (MCPS). If you come up with new way for the Windows 95 Chicken to cross the road, you can become a Microsoft Certified Solution Provider (MCSP.) But if you come up with a whole new chicken altogether, then you will become a Microsoft Certified Enemy (MSROADKILL)

      B: Microsoft Chicken (tm):
      A: Already owns both sides of the road and the space in the middle (check out "The Road Ahead", by Bill Gates). The Microsoft Chicken no longer worries about getting to the other side of the road. Its sole hell-bent mission is to somehow install MS Internet Explorer on your hard drive and choke the Netscape Chicken.

      B: Longhorn Chicken
      A: Struts around like it's king, but when it eventually crosses the road, it's indistinguishable from the XP Chicken

  25. Winner of all times by halleluja · · Score: 4, Funny

    telnet.c

  26. Learnings from the Competition ... by Crspe · · Score: 3, Insightful
    The goals of the competiton are ...
    • To show the importance of programming style, in an ironic way.
    • To stress C compilers with unusual code.
    • To illustrate some of the subtleties of the C language.
    • To provide a safe forum for poor C code. :-)

    They certainly achieve their goal of showing how bad caode can be and also of providing a safe forum for amazing C code.
    I have also learnt much better how to program in C, even for unobfuscated code. There is nothing like going through some of these entries to understand much better how the preprocessor works, and how compilers react to differrent constructs.
    So, the only goal left is that of stressing the C compilers ... does anyone have some good examples of bugs found *and later fixed* in c compilers due to this competition? There are certainly enough evidence of the compilers being crashed, but I wonder if anything positive has come out of it.
  27. Last Year's Winners by ajs318 · · Score: 2, Interesting

    I actually quite liked Hibachi. And not just for the animated logo! You can even run multiple instances on separate ports, and use NAT and port forwarding to get a poor man's virtual server setup.

    I'd recommend you stick to v1.0 {which is actually PD}, for licencing reasons. The v2.8 licence is unnecessarily restrictive.

    --
    Je fume. Tu fumes. Nous fûmes!
  28. Re:Mirrors WITH A CLICKABLE LINK by hugesmile · · Score: 2, Informative
  29. Who thinks.... by 10101001011 · · Score: 4, Funny

    We ought to submit the code for WIndows?

  30. Re:the joke's on Gassee by michaeldot · · Score: 3, Insightful

    Whoosh! I'll explain the scenario:

    No one knew the answer to the quiz question. When it became obvious no one was going to respond, Gassée decided to be facetious with that smug we're-better-than-everyone-else 1980s hubris that would later bring "old Apple" to its knees ("we're so cool we don't need to think about modernizing our OS architecture - you'll never be as good as us").

    It's hardly surprising Gates had no pity for Apple during the "GUI OS war" and probably relished seeing that smug attitude pounded into the dirt.

    And it's very fortunate for Apple that when Jobs returned to save it from bankruptcy, he took a groveling stance towards Gates and told the fanboys, "Microsoft is not the enemy. For Apple to survive, we have to do a really good job." A much better attitude than a smartass remark designed to antagonize an extremely powerful man.

  31. OMG by Hobbex · · Score: 3, Funny

    This clearly has no hacker cred what so ever if Visual Studio won't compile it!

    (Real men use visual basic!!!!)

  32. Re:Maze of Code - Does NOT work with Visual Studio by proverbialcow · · Score: 2, Informative

    Worked beautifully for me using gcc, like so:

    gcc -fwritable-strings -o maze maze.c

    --
    The only surefire protection against Microsoft infections is abstinence. - The Onion
  33. I wrote this to my (girl) friend by nsupathy · · Score: 3, Funny

    And she never replied back. Of course she knew programming.

    int ec(int c){return c-5;}
    void dc(char *s){if(*s){putchar (ec(*s));dc(s+1);}}
    int fp();se(f){f&1?fp():f&2?
    fp2(): f&4 ? fp3():0;}
    fp(){char t[4] = "";dc("N%fr%ytt%ynwji%ytif~33%|fsy%f%ltti%mtrj%rfi j%yjf%gjktwj%mjfinsl%mtrj$");putchar(012);dc("Nx%n y%utxxngqj%ytif~D%`~jx4stb%");gets(t);(!strcasecmp (t, "yes"))?
    se(2):se(4);}
    fp2(){char s[21]="";dc("|mfy%ynrj%hfs%N%iwtu%nsD%");gets(s);
    dc("N%|nqq%gj%ymjwj%g~%");puts(s);dc("Ymfsp%~tz") ; }
    fp3(){dc("N%fr%xt%xfi33333%");dc("Fs~|f~%ymfsp% ~tz %ktw%wzssnsl%ymnx");
    putchar(012); }
    main(){se(1);}

    --
    #include std_disclaimer.h
  34. Is it just me... by Minute+Work · · Score: 2, Funny

    ...or did any other web developers get their wires crossed when they read "18th International" and thought this had something to do with "I18N"?

  35. You want obfuscated? by prakslash · · Score: 3, Informative

    Try this:

    Whitespace

    It is so obfuscated, you cannot even see it!

    1. Re:You want obfuscated? by m50d · · Score: 2, Interesting

      It's pretty simple really though, you just have to convert it and then you've got your basic language, as long as you can handle stack-based programming it's a breeze. Ook is more to my liking.

      --
      I am trolling
  36. s/Oxymoron/Redundancy/; by LPetrazickis · · Score: 2, Informative

    "Military Intelligence" an "Microsoft Works" are oxymora. "Dead Corpse" and "Obfuscated C Code" are redundancies. Hope that helps. Have a nice day.^-^

    --
    Is this a sigs-optional kind of place? 'Cause I am totally down with that if you know what I mean.