Format fix 2012/omoikane/README.md

This commit is contained in:
Cody Boone Ferguson committed 2023-05-05 10:13:07 -07:00
1 parent 555bd89a4b
commit 87daf5d056
1 file changed
+58 -48
+58 -48
View File
@@ -1,8 +1,8 @@
# Most surreptitious # Most surreptitious
Don Yang Don Yang
<omoikane@uguu.org> <omoikane@uguu.org>
<http://uguu.org/> <http://uguu.org/>
## To build: ## To build:
@@ -36,81 +36,90 @@ cc -o output output.c
## Judges' remarks: ## Judges' remarks:
The judges have nothing to add that has not already been written The judges have nothing to add that has not already been written about in the
about in the `spoiler.html`` file! :-) [spoiler.html](spoiler.html) (requires JavaScript) file! :-)
## Author's remarks: ## Author's remarks:
### Usage ### Usage
Nyaruko is a binary to text filter. Given some input on stdin, `Nyaruko` is a binary to text filter. Given some input on stdin,
Nyaruko will produce C code that reproduces this input on stdout: `Nyaruko` will produce C code that reproduces this input on stdout:
./nyaruko < original.bin > output.c ```sh
gcc output.c -o output ./nyaruko < original.bin > output.c
./output > regenerated.bin gcc output.c -o output
./output > regenerated.bin
```
Output is encrypted, but both key and data are included in the output. Output is encrypted, but both key and data are included in the output.
To separate the key from the data, run these commands: To separate the key from the data, run these commands:
```sh
bash output.c > key.c bash output.c > key.c
perl output.c > data.c perl output.c > data.c
```
The key-less data.c still compiles, but produces a different message 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 on stdout instead of the original input. This message is a hint to
why the code is formatted the way it is. why the code is formatted the way it is.
To combine the key and data, concatenate them together in either To combine the key and data, concatenate them together in either
order: order:
```sh
cat key.c data.c > output.c cat key.c data.c > output.c
cat data.c key.c > output.c cat data.c key.c > output.c
```
By default, Nyaruko generates a unique random key for every message, By default, `Nyaruko` generates a unique random key for every message,
using /dev/urandom as the seed. If given an extra command line using `/dev/urandom` as the seed. If given an extra command line
argument, Nyaruko will seed using that file instead of /dev/urandom: argument, `Nyaruko` will seed using that file instead of `/dev/urandom`:
./nyaruko seed.txt < input.bin > output.c ```sh
./nyaruko seed.txt < input.bin > output.c
```
This makes the output key deterministic, allowing the same key to be This makes the output key deterministic, allowing the same key to be
shared across different files. On operating systems that do not have shared across different files. On operating systems that do not have
/dev/urandom, users should always specify this extra seed argument to `/dev/urandom`, users should always specify this extra seed argument to
avoid deterministic keys. avoid deterministic keys.
### Features ### Features
Implementation details that makes Nyaruko more obfuscated than usual Implementation details that make `Nyaruko` more obfuscated than usual
programs: programs:
* Nyaruko recycles variables and buffers to reduce internal state. * `Nyaruko` recycles variables and buffers to reduce internal state.
The variable names are also carefully chosen for mixed-case The variable names are also carefully chosen for mixed-case
madness. madness.
* Nyaruko employs some preprocessor magic to share much of the same * `Nyaruko` employs some preprocessor magic to share much of the same
code and state between the encoder and decoder, and to increase code and state between the encoder and decoder, and to increase
occurrences of smileys ;) occurrences of smileys ;)
Output code has these features: Output code has these features:
* Fits nicely under 80 columns, and does not contain any trigraphs. * Fits nicely under 80 columns, and does not contain any trigraphs.
* Uses a fairly efficient encoding scheme, better than uuencode for * Uses a fairly efficient encoding scheme, better than `uuencode` for
files larger than ~13K, and better than base64 for files larger files larger than ~13K, and better than `base64` for files larger
than 20K. than 20K.
* Encryption with ISAAC, a cryptographically secure pseudorandom * Encryption with [ISAAC](https://en.wikipedia.org/wiki/ISAAC_(cipher)), a
number generator. cryptographically secure pseudorandom number generator.
* Trivial 3 language polyglot. * Trivial 3 language polyglot.
Code layout is meant to resemble Nyaruko, also known as Nyarlathotep, Code layout is meant to resemble
the Crawling Chaos. The most obvious thing to do with chaos is to [Nyaruko](https://en.wikipedia.org/wiki/Nyarlathotep), also known as
make a random number generator, and the most obvious thing to do with `Nyarlathotep`, the Crawling Chaos. The most obvious thing to do with chaos is
a random number generator is to make one-time-pads for encryption. 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 ### Compatibility
Nyaruko has these environment dependencies: `Nyaruko` has these environment dependencies:
* Requires ASCII character set. * Requires ASCII character set.
* Assumes sizeof(unsigned int) == 4. * Assumes `sizeof(unsigned int) == 4`.
* Best viewed with tab stops set to 8 spaces. * Best viewed with tab stops set to 8 spaces.
Output code has the same dependencies, with the additional Output code has the same dependencies, with the additional
requirement that the compiler must support arbitrarily long string requirement that the compiler must support arbitrarily long string
@@ -118,23 +127,24 @@ literals. Maximum input size that can be encoded while still
producing standard-compliant output is ~276 bytes for C89, and ~3168 producing standard-compliant output is ~276 bytes for C89, and ~3168
bytes for C99. bytes for C99.
Nyaruko has been to verified to work with these compiler/OS `Nyaruko` has been to verified to work with these compiler/OS
combinations: combinations:
* gcc 4.4.5 on Linux (32bit and 64bit) * gcc 4.4.5 on Linux (32bit and 64bit)
* clang 3.1 on Windows (Cygwin) * clang 3.1 on Windows (Cygwin)
* gcc 4.5.3 on Windows (Cygwin) * gcc 4.5.3 on Windows (Cygwin)
* gcc 4.5.3 on Windows (MingW) * gcc 4.5.3 on Windows (MingW)
* gcc 4.3.5 on JSLinux * gcc 4.3.5 on JSLinux
* tcc 0.9.25 on JSLinux * tcc 0.9.25 on JSLinux
Note that on MingW, stdin and stdout are not opened in binary mode by 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. default, this means `Nyaruko` may not faithfully encode files on MingW.
### Extra files ### Extra files
spoiler.html - Contains full recording of how the code went from [spoiler.html](spoiler.html) - Contains full recording of how the code went from
blank state to an obfuscated program, gzipped to fit under 1MB. blank state to an obfuscated program, gzipped to fit under 1MB. Requires
JavaScript.
## Copyright and CC BY-SA 4.0 License: ## Copyright and CC BY-SA 4.0 License: