IOCCC image by Matt Zucker

The International Obfuscated C Code Contest

2015/hou - Most well rounded hash

MD5 without integers

Author:

To build:

    make

Bugs and (Mis)features:

The current status of this entry is:

STATUS: INABIAF - please DO NOT fix

For more detailed information see 2015/hou in bugs.html.

To use:

    echo something | ./prog
    ./prog < file

Try:

    ./try.sh

Judges’ remarks:

A good start for understanding this entry might be rfc1321.txt. How does it compute this using only a single looping construct? The original reference source code for this algorithm is about 355 lines of code, yet this entry is only 199 lines with one statement per line and it isn’t using lots of macro expansion tricks like the reference code!

Some things that make you go, “huh?”

    ./prog < prog.c | cut -c-5
    ./prog < Makefile | cut -c-4

How are those values magically returned?

What happens with a large file? Something over 256K.

    ./prog < large_file

Where does that message come from?

Author’s remarks:

This looks like a normal C program.

Almost everything is a double.

There are tell-tale signs like pow(2,(?/12)) and exp(-?*?) (names redacted). You can also find a bunch of cosines and polynomial evaluations.

It looks like a ????? ???????????, right?

Run and find out.

Why obfuscated

Some poor scripting folks only have access to doubles (Jav?script, L?a, BA?IC, etc.).

As a C programmer, I feel obliged to show a gesture of sympathy, to experience their pain and provide an answer.

Except when absolutely necessary (printf, int main(), array indexing), there isn’t a single integer. Even getchar() and EOF are immediately converted.

Since bool counts as an integer type too, there is no boolean either. No comparison, no if, no ?:, no || &&. Everything is done in a single loop that terminates on printf(3). Straight up arithmetic.

floor(3) and ceil(3) are technically double-to-double functions, but they feel like cheating. Yes cos(3), no floor(3).

Limitations

Hard requirements:

Soft requirements:

Tested platforms:

Inventory for 2015/hou

Primary files

Secondary files


Jump to: top