Files
ioccc/2012/vik
Landon Curt Noll 2b92c89be8 fix and improve links within the web site
Entry source is now prog.c for IOCCC years 2014 thru 2020,
or is now dirname.c IOCCC years 1984 thru 2013.

To achieve this state, we renamed the following:

renamed:    2004/hibachi/src/hibachi.c -> 2004/hibachi/hibachi.c
renamed:    2012/omoikane/nyaruko.alt.c -> 2012/omoikane/omoikane.alt.c
renamed:    2012/omoikane/nyaruko.alt2.c -> 2012/omoikane/omoikane.alt2.c
renamed:    2012/omoikane/nyaruko.c -> 2012/omoikane/omoikane.c
renamed:    2012/omoikane/nyaruko.orig.c -> 2012/omoikane/omoikane.orig.c

Modified `bin/subst.entry-index.sh` to add to entry `index.html` file,
links to the `Makefile` and the _C code_ to the top navigation bar.
Changed `bin/subst.entry-index.sh` VERSION from "1.2.2 2024-02-25"
to "1.3 2024-03-02".

Moved printing the Inventory link in the top navigation bar
from `bin/subst.entry-navbar.awk` to `bin/subst.entry-index.sh`.
Changed `bin/subst.entry-navbar.awk` VERSION from "1.0.1 2024-02-23"
to "1.1 2024-03-02".

Moved printing the Inventory link in the top navigation bar
from `bin/subst.year-navbar.awk` to `bin/subst.year-index.sh`.
Changed `bin/subst.year-index.sh` VERSION from "1.0 2024-02-11"
to "1.1 2024-03-02".
Changed `bin/subst.year-navbar.awk` VERSION from "1.0 2024-02-11"
to "1.1 2024-03-02".

Added location names (both default and common) to `author.html`.
Changed `tmp/gen_author_json.sh` VERSION from "1.0 2023-06-06"
to "1.1 2024-03-04".

Added location names (both default and common) to `author.html`.
Changed `bin/gen-authors.sh` VERSION from "1.2 2024-03-09"
to "1.3 2024-03-04".

The manifest and the resulting `.entry.json` files have been changed
for `2004/hibachi` and `2012/omoikane`.

The Makefiles for  `2004/hibachi` and `2012/omoikane` copy the
source file into the "previously used location".  The `make clobber`
rule removes the copied source.  The `.gitignore` files have been
updated accordingly.

Improved how the concept of IOCCC terms _entry_, _author_ and _submission_ are
used in markdown files.

Links to markdown files (files ending in .md) within the repo were
changed to link to HTML files (files ending in .html).  Special cases
where `README.md` became `index.html` were modified accordingly.

Fixed URL for `bugs.html` in Makefile comments.

Fixed name of `bin/sgi.sh` referenced in comments in `.gitignore` files.

Links to locations within the repo are now relative.  For example a
link to `/contact.html` may become `../contact.html' or '../../contact.html`
depending on the directory level of the markdown file.

Nearly all links with absolute URLs under _https://www.ioccc.org_
or `https://ioccc-src.github.io/temp-test-ioccc_ have been changed to
relative paths within the repo.  Some exceptions to this (such as
referring to a GitHub repo) were preserved.

Fixed a number of inside `faq.md` and `bugs.md`.

Added HTML name tags (in the form of an _entry_id_) for each entry
referenced in `bugs.md`.  Fixed links from outside of `bugs.html`
into `bugs.html` accordingly.

Where FAQ entries are referenced, a named tag is used so that if a
FAQ is ever renumbered, links outside of `faq.html` will still work.

Changed the _inventory_order_ of a compressed tarball from _300_
to _100000_.  While this may have been done for the manifest,
this changed had not yet been propagated into the `.entry.json` files.

Links to web sites that were in the for <URL> are now [URL](URL).

Performed `name www` to process all of the above.

Improved format of `authors.html`.  Full names are now bold.
Location codes are now links back into `location.html` and
location names (both default and common) are now italics.
Added _author_handle_ each author.

Changed `bin/gen-authors.sh` VERSION from "1.1 2024-02-25"
to "1.2 2024-03-09".

Improved format of `location.html` as location codes are now bold,
author counts in a given location are now bold, and location names
(both default and common) are now italics.

Changed `bin/gen-location.sh` VERSION from "1.0.1 2024-02-23"
to "1.1 2024-03-04".

Added italic location name after location code in entry
`index.html` files.

Changed `bin/output-index-author.sh` VERSION from "1.4.1 2024-02-23"
to "1.5 2024-03-04".

Added _Location of authors_ to the sidebar as a link to `location.html`.

TODO: While nearly all of the above mentioned changes are likely correct,
      they likely introduced a few errors that need correcting.
2024-03-04 23:45:28 -08:00
..
2024-02-27 23:21:32 -08:00
2020-12-30 16:57:03 -08:00
2020-12-30 16:57:03 -08:00
2020-12-30 16:57:03 -08:00
2023-07-06 21:49:38 -07:00

To build:

make

This entry requires Zlib.

There is an alternate version which might work for Windows. See Alternate code section below.

Bugs and (Mis)features:

The current status of this entry is:

STATUS: INABIAF - please **DO NOT** fix

For more detailed information see 2012 vik bugs.

To use:

To embed text (from file or command line):

./vik e base.png filename > encodedimg.png

or

./vik e base.png SomeRandomText > encodedimg.png

To extract the embedded text:

./vik d encodedimg.png

To embed a PNG into another:

./vik e base.png source.png > encodedimg.png

To extract the embedded PNG:

./vik d encodedimg.png > restored.png

Try:

./try.sh

Alternate code:

For those few who might use Windows this alternate code might work.

Alternate build:

make alt

Alternate use:

Use vik.alt as you would vik above.

Judges' remarks:

References to chocolate had no effect on judging this entry. We guarantee it.

Can you discern hidden pieces of chocolate in chocolate-in-ioccc.png?

chocolate in ioccc

Author's remarks:

Introduction

This program is a steganography application for embedding an image or text into another image as well as extracting the embedded image or text back. The program stores the embedded image or text in the low bits of the RGB values.

The program supports any 8 bit true color PNG images (RGB, RGBA, greyscale, and greyscale+alpha). The output image is always 8 bit RGB. When embedding one image into another, the width and height needs to be the same.

The program only updates the IDAT and IHDR chunks of the source image. Any additional chunks are copied into the resulting image.

Bonus Extractor:

For some reason the chocolate image seems to have some special properties. Apart from being quite big and a little bit noisy, it appears that when embedded into another image and extracted, the bitmap data is also a valid brainfuck program. It is of course possible to get the bitmap data from the extracted image, and run it through any of the previous winning brainfuck interpreters, but I thought it would be easier to include an interpreter in the program to avoid the hassle:

./vik e ioccc.png chocolate.png > encodedimg.png
./vik b encodedimg.png

It is of course also possible to embed a brainfuck program as a text file (as explained above) and decode it, e.g.:

./vik e ioccc.png .+[.+] > encodedimg.png
./vik b encodedimg.png

Obfuscation

I really wanted to keep the program simple, so instead of adding multiple macros or helper methods that can be confusing, I placed all functionality in the main() function. main() is called recursively and quite extensively, but it gives the benefit that all invocations of the function have the same parameters, argv and argc. This really helps readability, as a programmer doesn't need to remember several variable or function names. I also tried to reduce the number of keywords, and the program only has four for loops followed by a single return statement. There is a little bit of use of the ternary (?:) operator, but this is really there to keep the program as simple as possible.

Portability

The program is portable to most platforms that have zlib available. The only system dependency is that the program relies on writing binary data to stdout.

By default, Microsoft compilers adds carriage returns to new lines, and to compile the program on this platform, the following line can be added after the variable declarations in the main declaration in order to run correctly:

_setmode(_fileno(stdout), 0x8000);

NOTE: this is what the Alternate code does.

Limitations

The program doesn't have many error checks so passing in invalid arguments or images of mismatching sizes, or unsupported pixel formats will cause the program to crash.

Extendability

Since a lot of care was taken to keep the code simple, it turned out to be quite easy to extend functionality. I did include a small brainfuck after I realized that the chocolate image had some interesting properties.

But there is more functionality I added that didn't fit within the size limits and could not remain included. For example, I added a method to format source code based on a PNG image. So the format of the program is actually done by the program itself.

And to be honest, the chocolate image did not have a brainfuck program embedded to begin with. I added functionality to the program to embed a brainfuck into a PNG image and used it to create the image provided with the entry.

I also added a method to analyze PNG images, to print the size and format, as well as the scan line filters.

All these features were quite easy to add, much thanks to the (actually pretty good) design of the code.

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/