Add 2004/sds/try.sh + format/typo checks
The try.sh script runs what used to be in the try section. Format/typo fix README.md in full. This commit also fixes an inconsistency where the author unwittingly used the word stenography instead of steganography, a very easy mistake to make and one that I almost missed. Updated Makefile to silence a couple warnings. Updated .gitignore.
This commit is contained in:
1 parent
bcd2d9a063
commit
e5273c3404
5 files changed
+79
-32
No files matched your search
@@ -8,3 +8,4 @@ sds_msg
|
||||
sds_msg.c
|
||||
sds.orig
|
||||
prog.orig
|
||||
remarks.md
|
||||
+2
-1
@@ -38,7 +38,8 @@ include ../../var.mk
|
||||
|
||||
# Common C compiler warnings to silence
|
||||
#
|
||||
CSILENCE= -Wno-unsequenced -Wno-unused-value -Wno-strict-prototypes
|
||||
CSILENCE= -Wno-unsequenced -Wno-unused-value -Wno-strict-prototypes -Wno-unused-parameter \
|
||||
-Wno-implicit-int
|
||||
|
||||
# Common C compiler warning flags
|
||||
#
|
||||
|
||||
+16
-31
@@ -26,27 +26,12 @@ For more detailed information see [2004 sds in bugs.md](/bugs.md#2004-sds).
|
||||
### Try:
|
||||
|
||||
```sh
|
||||
./sds < sds.c > encoder.c
|
||||
make encoder
|
||||
./encoder README.md <sds.c >sds_msg.c
|
||||
make sds_msg
|
||||
./sds_msg < sds.c > sds2_msg.c
|
||||
diff sds2_msg.c encoder.c
|
||||
```
|
||||
|
||||
Also try:
|
||||
|
||||
```sh
|
||||
echo 'Hello, World!' > message
|
||||
./encoder message < README.md > remarks.md
|
||||
diff remarks.md README.md # notice how similar they are
|
||||
|
||||
# and then observe:
|
||||
./sds < remarks.md
|
||||
./try.sh
|
||||
```
|
||||
|
||||
The generated code will very likely crash or do something else if not given a
|
||||
proper command line. This is not a bug but a feature.
|
||||
proper command line, like a file that can be opened with `fopen(3)`. This is not
|
||||
a bug but a feature.
|
||||
|
||||
This is supposed to happen. As is written in the
|
||||
[The Jargon File](http://catb.org/jargon/html/F/feature.html):
|
||||
@@ -71,21 +56,20 @@ been done to a message for us to hide one in the remarks. :)
|
||||
|
||||
## Author's remarks:
|
||||
|
||||
Stenography is the term for the family of techniques used for
|
||||
hiding information within other information. Today, it has many real
|
||||
world uses, particularly for digital watermarking.
|
||||
[Steganography](https://en.wikipedia.org/wiki/Steganography) is the term for the
|
||||
family of techniques used for hiding information within other information.
|
||||
Today, it has many real world uses, particularly for digital watermarking.
|
||||
|
||||
This program uses a stenographic technique to hide information in
|
||||
any text file. The specific technique used is aimed at writers of
|
||||
obfuscated programs for the IOCCC, as the hidden information is
|
||||
encoded in the whitespace in the source file. As we know, there are
|
||||
up to an additional 2048 characters of whitespace available to
|
||||
entrants to the IOCCC, so it turns out that this is an ideal place to
|
||||
hide things.
|
||||
This program uses a steganographic technique to hide information in any text
|
||||
file. The specific technique used is aimed at writers of obfuscated programs
|
||||
for the IOCCC, as the hidden information is encoded in the whitespace in the
|
||||
source file. As we know, there are up to an additional 2048 characters of
|
||||
whitespace available to entrants to the IOCCC, so it turns out that this is an
|
||||
ideal place to hide things.
|
||||
|
||||
The program as provided is the stenographic decoder. Rather than
|
||||
The program as provided is the steganographic decoder. Rather than
|
||||
provide a separate encoding program, you should not be surprised to
|
||||
learn that I opted to stenographically hide the encoder inside the
|
||||
learn that I opted to steganographically hide the encoder inside the
|
||||
decoder.
|
||||
|
||||
Try it out. Compile the program, then type
|
||||
@@ -100,7 +84,7 @@ You should see the encoder program displayed. Now save it, like:
|
||||
sds < sds.c > encoder.c
|
||||
```
|
||||
|
||||
Then compile encoder.c. You now have the complete system ready.
|
||||
Then compile `encoder.c`. You now have the complete system ready.
|
||||
|
||||
The encoder expects to get a filename as an argument. This filename
|
||||
is the name of the file containing the information to be hidden. It
|
||||
@@ -127,6 +111,7 @@ changed inside strings where it should be left alone. Plain text
|
||||
files are good candidates for hiding information in, but the added
|
||||
spacing may render the text somewhat difficult to read.
|
||||
|
||||
|
||||
### Obfuscation
|
||||
|
||||
This program is obfuscated in a number of ways:
|
||||
|
||||
Executable
+55
@@ -0,0 +1,55 @@
|
||||
#!/usr/bin/env bash
|
||||
#
|
||||
# try.sh - demonstrate IOCCC winner 2004/sds
|
||||
#
|
||||
|
||||
# make sure CC is set so that when we do make CC="$CC" it isn't empty. Doing it
|
||||
# this way allows us to have the user specify a different compiler in an easy
|
||||
# way.
|
||||
if [[ -z "$CC" ]]; then
|
||||
CC="cc"
|
||||
fi
|
||||
|
||||
make CC="$CC" all >/dev/null || exit 1
|
||||
|
||||
# clear screen after compilation so that only the entry is shown
|
||||
clear
|
||||
|
||||
echo "$ ./sds < sds.c > encoder.c" 1>&2
|
||||
./sds < sds.c > encoder.c
|
||||
echo 1>&2
|
||||
|
||||
echo "$ make encoder 2>/dev/null" 1>&2
|
||||
make encoder 2>/dev/null
|
||||
echo 1>&2
|
||||
|
||||
echo "$ ./encoder README.md <sds.c >sds_msg.c"
|
||||
./encoder README.md <sds.c >sds_msg.c
|
||||
|
||||
echo "$ make sds_msg 2>/dev/null" 1>&2
|
||||
make sds_msg 2>/dev/null
|
||||
echo 1>&2
|
||||
|
||||
echo "$ ./sds_msg < sds.c > sds2_msg.c" 1>&2
|
||||
./sds_msg < sds.c > sds2_msg.c
|
||||
|
||||
echo "$ diff sds2_msg.c encoder.c" 1>&2
|
||||
diff sds2_msg.c encoder.c
|
||||
|
||||
echo "$ echo 'Hello, World!' > message" 1>&2
|
||||
echo 'Hello, World!' > message
|
||||
|
||||
echo "$ ./encoder message < README.md > remarks.md" 1>&2
|
||||
./encoder message < README.md > remarks.md
|
||||
|
||||
read -r -n 1 -p "Press any key to show diff remarks.md README.md: "
|
||||
echo "$ diff remarks.md README.md" 1>&2
|
||||
diff remarks.md README.md # notice how similar they are
|
||||
echo "Did you notice how similar they are?" 1>&2
|
||||
echo 1>&2
|
||||
read -r -n 1 -p "Press any key to continue: "
|
||||
|
||||
echo 1>&2
|
||||
# and then observe:
|
||||
echo "$ ./sds < remarks.md" 1>&2
|
||||
./sds < remarks.md
|
||||
@@ -2789,6 +2789,11 @@ fast in modern systems, especially the scrolling text of
|
||||
[schnitzi.inp1](schnitzi.inp1).
|
||||
|
||||
|
||||
## [2004/sds](2004/sds/sds.c) ([README.md](2004/sds/README.md))
|
||||
|
||||
Cody added the [try.sh](2004/sds/try.sh) script.
|
||||
|
||||
|
||||
## [2004/vik2](2004/vik2/vik2.c) ([README.md](2004/vik2/README.md))
|
||||
|
||||
Cody fixed this to compile in Linux. Although it compiled cleanly in macOS (and
|
||||
|
||||
Reference in new issue
Block a user