Files
ioccc/2012/omoikane
Cody Boone Ferguson ef456bfb1e Mass typo fixes
This is a HUGE commit:

    417 files changed, 874 insertions(+), 874 deletions(-)

As the IOCCC website now is https enabled I have updated the
'http://www.ioccc' to 'https://www.ioccc'.

There was also a typo in Makefiles where it said 'for VERY WELCOME' when
it should be 'are VERY WELCOME'.

Finally slashdot.org is also https enabled so references to
'http://slashdot' were changed to 'https://slashdot'.

This was done by my sgit tool (see https://github.com/xexyl/sgit)
like:

    sgit -e 's,http://www.ioccc,https://www.ioccc,g' -e 's/for VERY WELCOME/are VERY WELCOME/g' -e  .

but because I didn't have a list of files that should be modified I had
to be careful which files to commit as I had files that were changed but
not ready to be committed. Since I did it in steps, finding typos as I
went along, I actually ran sgit three times but to simplify the above
(and to show that it's possible to do more than one sed command) I made
it all as one. Since I did not have a list of files ahead of time I had
to determine what files to commit, first going through them like:

    for j in $(for i in $(git status|grep modified|cut -d: -f2); do \
	git grep 'https://www.ioccc' "$i"; done|cut -d: -f1|sort|uniq); \
	do git diff "$j"; done|less -r

(I had to pipe through less because of a strange problem with the git
diff which appears to be because of a terminal problem maybe due to the
command above but it was all I could come up with in a very tired head.)

The above and

    git status | grep modified:

showed that some C files had been modified which obviously should not be
done so I had to do:

    git co '*c'

to undo those changes.

Finally to commit the correct files I did:

    for i in $(git status|grep modified|cut -d: -f2); do \
	git grep -E 'https://www.ioccc|https://slashdot|are VERY WELCOME' "$i"; \
	done |cut -d: -f1|sort|uniq|xargs git commit -v

or so (with any formatting issues or typos here due to typos in the log
due to the terminal (in)sanity issue described).
2023-10-07 04:35:47 -07:00
..
2023-05-13 11:45:33 +10:00
2023-10-07 04:35:47 -07:00
2020-12-30 16:57:03 -08:00
2023-07-06 21:49:38 -07:00
2023-05-05 10:13:07 -07:00

Most surreptitious

Don Yang
omoikane@uguu.org
http://uguu.org/

To build:

make

To run:

./nyaruko [seed.txt] < original.bin > output.c
bash output.c > key.c
perl output.c > data.c

cat key.c data.c > output.c

gcc output.c -o output
./output > regenerated.bin

Try:

echo "A quick brown fox jumps over the lazy dog" | ./nyaruko > output.c
perl output.c > data.c
cc -o data data.c
./data
cc -o output output.c
./output

Judges' remarks:

The judges have nothing to add that has not already been written about in the spoiler.html (requires JavaScript) file! :-)

Author's remarks:

Usage

Nyaruko is a binary to text filter. Given some input on stdin, Nyaruko will produce C code that reproduces this input on stdout:

./nyaruko < original.bin > output.c
gcc output.c -o output
./output > regenerated.bin

Output is encrypted, but both key and data are included in the output. To separate the key from the data, run these commands:

    bash output.c > key.c
    perl output.c > data.c

The key-less data.c still compiles, but produces a different message on stdout instead of the original input. This message is a hint to why the code is formatted the way it is.

To combine the key and data, concatenate them together in either order:

    cat key.c data.c > output.c
    cat data.c key.c > output.c

By default, Nyaruko generates a unique random key for every message, using /dev/urandom as the seed. If given an extra command line argument, Nyaruko will seed using that file instead of /dev/urandom:

./nyaruko seed.txt < input.bin > output.c

This makes the output key deterministic, allowing the same key to be shared across different files. On operating systems that do not have /dev/urandom, users should always specify this extra seed argument to avoid deterministic keys.

Features

Implementation details that make Nyaruko more obfuscated than usual programs:

  • Nyaruko recycles variables and buffers to reduce internal state. The variable names are also carefully chosen for mixed-case madness.
  • Nyaruko employs some preprocessor magic to share much of the same code and state between the encoder and decoder, and to increase occurrences of smileys ;)

Output code has these features:

  • Fits nicely under 80 columns, and does not contain any trigraphs.
  • Uses a fairly efficient encoding scheme, better than uuencode for files larger than ~13K, and better than base64 for files larger than 20K.
  • Encryption with ISAAC, a cryptographically secure pseudorandom number generator.
  • Trivial 3 language polyglot.

Code layout is meant to resemble Nyaruko, also known as Nyarlathotep, the Crawling Chaos. The most obvious thing to do with chaos is to make a random number generator, and the most obvious thing to do with a random number generator is to make one-time-pads for encryption.

Compatibility

Nyaruko has these environment dependencies:

  • Requires ASCII character set.
  • Assumes sizeof(unsigned int) == 4.
  • Best viewed with tab stops set to 8 spaces.

Output code has the same dependencies, with the additional requirement that the compiler must support arbitrarily long string literals. Maximum input size that can be encoded while still producing standard-compliant output is ~276 bytes for C89, and ~3168 bytes for C99.

Nyaruko has been to verified to work with these compiler/OS combinations:

  • gcc 4.4.5 on Linux (32bit and 64bit)
  • clang 3.1 on Windows (Cygwin)
  • gcc 4.5.3 on Windows (Cygwin)
  • gcc 4.5.3 on Windows (MingW)
  • gcc 4.3.5 on JSLinux
  • tcc 0.9.25 on JSLinux

Note that on MingW, stdin and stdout are not opened in binary mode by default, this means Nyaruko may not faithfully encode files on MingW.

Extra files

spoiler.html - Contains full recording of how the code went from blank state to an obfuscated program, gzipped to fit under 1MB. Requires JavaScript.

This file is Copyright (c) 2023 by Landon Curt Noll. All Rights Reserved. You are free to share and adapt this file under the terms of this license:

Creative Commons Attribution-ShareAlike 4.0 International (CC BY-SA 4.0)

For more information, see: https://creativecommons.org/licenses/by-sa/4.0/