IOCCC

The International Obfuscated C Code Contest

A 27th IOCCC Winner

Best utility

Ilya Kurdyukov
https://github.com/ilyakurdyukov
Twitter: @ilyakurdyukov

The code for this entry can be found in prog.c

Judges' comments:

To use:

make
./prog

Try:

# Obfuscated IOCCC
echo IOCCC | ./prog

./prog < prog.x86.asm

./prog < prog.x86_64.asm

Selected Judges Remarks:

This hash of a C code makes a hash out of input. Do you understand how? You should get a-round-to-it figuring it out!

Author’s comments:

MD5 with integers

Just a tiny MD5 checksum utility. Prints hash string of data from stdin. Work same as (openssl md5 | cut -d' ' -f2) command.

My objectives

  1. reduce code size as much as possible
  2. avoid warnings from GCC/CLANG -Wall -Wextra -pedantic
  3. portable (regardless of register size and endianness)
  4. fit code in a round shape
  5. no macro defines
  6. no floating-point arithmetics

Notes

The main difficulty of making MD5 code smaller is a 64x4 bytes long table with constants. Which will take more than 512 bytes in text hex encoding. This table is a results of a sine function, so can be generated dynamically, but merging floating-point arithmetics with precise integer calculations is not a great idea, because can make portability issues.

Attempts to satisfy CLANG -Weverything will ruin comma magic, that is so great for obfuscation, so I don’t want to care about that.

Probably, should work correctly on any machines, but I have nothing exotic (like BE or not 32/64) to try it.

Added a macro hack to make stdin work in binary mode under Windows (tested under mingw64), otherwise the hashes can be incorrect.

Bonus



Creative Commons License

© Copyright 1984-2020, Leo Broukhis, Simon Cooper, Landon Curt Noll - All rights reserved
This work is licensed under a Creative Commons Attribution-ShareAlike 3.0 Unported License.