Author:
To build:
make
To use:
echo Some text | ./prog
Try:
./try.sh
Judges’ remarks:
Before analysing the code in detail we were able to guess two out of four tests this entry uses to tell the 5 languages/flavors apart. Can you find all four?
The way the text is encoded in the output doesn’t cease to amaze. Can you tell why an array of 512 elements is needed?
NOTE: the author calls the program Fuuko
and so the source file referred to in
their remarks uses fuuko.c
. The Makefile will compile everything
so you need not worry about this.
Author’s remarks:
Fuuko
is a sea star generator. Feed
her some input through stdin
to get lots of sea star patterns on stdout
.
cc -O3 -std=c90 fuuko.c -lm -o fuuko_c90
echo IOCCC | ./fuuko_c90 > output_c90.c
If you compile with a C99 compiler instead of C90, the sea stars will have eyes.
cc -O3 -std=c99 fuuko.c -lm -o fuuko_c99
echo IOCCC | ./fuuko_c99 > output_c99.c
Don’t like sea stars? Use a C++98 compiler to get a dango instead.
g++ -O3 -std=c++98 fuuko.c -lm -o fuuko_cpp98
echo IOCCC | ./fuuko_cpp98 > output_cpp98.c
Don’t like dango either? Use a C++11 compiler to get just circles (or Swiss cheese, if you prefer that).
g++ -O3 -std=c++11 fuuko.c -lm -o fuuko_cpp11
echo IOCCC | ./fuuko_cpp11 > output_cpp11.c
Don’t like any of these patterns? Use a C11 compiler and there will be no extra pattern.
cc -O3 -std=c11 fuuko.c -lm -o fuuko_c11
echo IOCCC | ./fuuko_c11 > output_c11.c
Regardless of which of these C/C++ dialects you choose, the output
will all be valid C90 code that reproduces original input on stdout
,
filled with pointer dereferences (C stars).
Next time people ask you for a few pointers on C, you can run their
question through Fuuko
and give them pointers all day long.
Compatibility
Fuuko
has been tested under these environments:
- gcc 4.9.3 on Cygwin
- gcc 4.9.2 on Linux
- gcc 4.8.4 on Linux
- gcc 4.6.3 on Linux (doesn’t support C11 nor C++11)
- gcc 4.3.5 on JS/Linux
- clang 3.5.2 on Cygwin (doesn’t work with optimization enabled, probably cygwin bug)
- clang 3.5.0 on Linux
- clang 3.4.1 on Linux
- tcc 0.9.25 on JS/Linux (C99 only)
Features
The most obscure parts are in detecting the subtle differences in
different dialects. The standard committees put a lot of effort into
avoiding “quiet changes”, but Fuuko
is still able to exploit a few of
those. It should be an interesting exercise for the reader to figure
how she did it.
Output patterns are usually random (except for C11). The built-in random number
generator is seeded using
ASLR. On
systems where ASLR is not so random (such as cygwin), you can introduce
randomness by changing number of command line arguments to Fuuko
.
Output is somewhat robust: corruption on most of the lines will usually result in a compiler warning. This is because the output is vastly redundant: For ~1K of input, expect output to be on the order of ~1MB, and take ~500MB of RAM to compile.
CRC32 of source code is embedded in the source code itself.
The process of writing this program can be seen by opening obfuscation.html in a browser that supports JavaScript.
Code layout is inspired by Ibuki Fuuko, for her love of sea stars.
Inventory for 2015/yang
Primary files
- prog.c - entry source code
- Makefile - entry Makefile
- prog.orig.c - original source code
- try.sh - script to try entry
- obfuscation.html - JavaScript page with full recording of development
Secondary files
- 2015_yang.tar.bz2 - download entry tarball
- README.md - markdown source for this web page
- .entry.json - entry summary and manifest in JSON
- .gitignore - list of files that should not be committed under git
- .path - directory path from top level directory
- index.html - this web page