Underhanded C Contest

July 25, 2008

I recently discovered the Underhanded C Contest. It’s a contest where the goal is to write a C program which looks like it’s innocently doing something straightforward, and yet it slyly doing something innocuous which is not at all obvious from reading the source code. The shorter program, the better, since it’s a lot harder to hide something in a short snippet. It’s sort of the polar opposite of the Obfuscated C Contest, where the goal is to create the most horrible looking code possible that does something useful.

Past winners of the Underhanded C Contest have done things such as using the XOR swap with two of the same argument (in a non-obvious fashion) and mis-declaring the function prototypes of standard library functions to mess with the stack. This description, however, doesn’t do the 2007 winner justice. Head on over to the 2007 winners page and see just how crafty that one was.

The contest for 2008 is to essentially black out portions of an image while maintaining all or most of the information needed to reconstruct the original image. Can you do it with innocent-looking code?

Comments are closed.