IOCCC image by Matt Zucker

The International Obfuscated C Code Contest

2025/mattpep - Most obfuscated options

Base64 encoder/decoder

Author:

Award: Most obfuscated options

To build:

    make all

To use:

    ./prog decode < file.b64 > file.bin
    ./prog encode < file.bin > file.b64

Try:

    ./try.sh

Judges’ remarks:

Thankfully, the Cyrillic capital letter Ч is quite distinct from the digit 4. That’s all we’ll say.

For the rest, it is RTFS. :-)

A fun challenge

Explain how the argument to ./prog determines if input is encoded or decoded.

The above fun challenge is still open. See the “Fun challenge Info” section for details.

Author’s remarks:

Description

Obfuscated Base64 encoder/decoder.

Running

Supply parameters indicating whether to encode or decode. (Default action if no parameter given is to decode from Base64)

    ./prog encode < test-4k.bin > test-4k.b64

or

    ./prog decode < test-4k.b64 > test-4k.bin.new

or for a primitive validation test in one line:

    ./prog encode < test-4k.bin | ./prog decode | diff -s - test-4k.bin

The program will also respond to the magic numbers 2503 and its string-reverse 3052:

    # this encodes to base 64
    ./prog 3052 < test-4k.bin > test-4k.b64 # this encodes to base 64

    # this decodes from base 64 (you'll likely need to reset your terminal afterwards)
    ./prog 2503 < test-4k.b64

The legacy magic number 2053 (and its reverse 3502) also yield the same set of results.

One can use polite or rude language:

    ./prog Would you please encode this < test-5k.bin
    ./prog fucking decode this < test-4k.b64

Additionally, the obscenities can be censored:

    ./prog "#$@!ing decode this" < test-4k.b64
    ./prog "Would you #@%!ing encode this" < test-4k.bin

One gets unexpected results with

    ./prog fucking encode this < secret.txt
    cat infile.b64 | ./prog Would you please decode this
    cat infile.b64 | ./prog --decode

But the following behaves as expected

    ./prog --encode < test-4k.bin

Provided test data

There are 2 primary files containing random binary data (read from /dev/urandom on the author’s system), named to indicate their size:

There are also 6 tiny text files (ranging from 1 to 6 bytes in size) - these were used during development in order to test the padding functionality. Files are named to indicate their size in bytes. No trailing newlines exist in these files.

Lastly there is a file containing a not-so-secret message, used in one of the examples above:

Obfuscation techniques

Limitations

Inventory for 2025/mattpep

Primary files

Secondary files


 Jump to: top