SpamBoinkCheese
A Unix command-line implementation of the SpamBoinkCheese (SBC) encoding
Contained on this page is everything you could possibly need to use
SpamBoinkCheese on a standard Unix system. The source code, available below,
was written in standard ANSI C. The only prerequisite is the GNU getopt
library (any self-respecting Unix system has it installed). Everything
happens through stdin/stdout pipes, so sbc (as the program is called) can
be placed in a chain of other Unix commands.
Background
Taken from http://wiki.feedle.net/wikimayo/SpamBoinkCheese:
...another DefCon story: At DefCon 9, Feedle and I were bombing around Las Vegas (in my rented Dodge Neon) looking for trouble to cause, as well as to pick up some clothing items at the last minute (see Feedle's DefCon 9 Top Ten list ) for the Black and White ball. Anyway, we're babbling incoherently, like geeks are wont to do, and we touch on the topic of packet radio, and ?AudioFrequencyShiftKeying. (If you're a ?HamRadio operator, you may have an idea of what packet sounds like -- it's like a short modem "braaaap")
Anyway, we get to talking about older protocols, and the subject of ASCII Baudot, and RTTY come up. You've probably heard such protocols as computer 'sound effects' in various movies and TV shows. Basically, most 'digital' communications over an analog circuit (such as a standard analog voice line, or a radio circuit) are converted to 2 tones: the mark, or 1, tone, and the space, or 0, tone. These tones were usually very dissimilar (ie: 2200Hz for the Mark, and 1000Hz for the space). Also, there's a null carrier tone that's usually presented as well. (interesting sidenote: in the days of old RTTY, the pattern RYRYRYRYRYRY (ad nauseum) was sent as a preface to an RTTY message -- it had the characteristic of being an alternating pattern of marks and spaces, which allowed for easier tuning using an oscilliscope)
Feedle, however, has already come up with a protocol to convey text using the human voice to perform ?VocalFrequencyShiftKeying. Using the words Spam (for the mark), Boink (for the space), and Cheese (for the null carrier, with the ee being elongated -- think cheeeeeeeeeeeeeese), a rudimentary binary code could be established for digital transfer of information between humans. Thus a rudimentary 'Hello.' in 8 bit characters with 4 nulls at the end would become (hardlines inserted for readability):
BoinkSpamBoinkBoinkSpamBoinkBoinkBoinkCheese BoinkSpamSpamBoinkBoinkSpamBoinkSpamCheese
BoinkSpamSpamBoinkSpamSpamBoinkBoinkCheese BoinkSpamSpamBoinkSpamSpamBoinkBoinkCheese
BoinkSpamSpamBoinkSpamSpamSpamSpamCheese BoinkBoinkSpamBoinkSpamSpamSpamBoinkCheeseCheeseCheeseCheese
There are variations in this using different encodings (character tables) and different tones (such as DweebNerdDude , and the ever-popular BamSpoinkSleaze variants.)
Implementation
This implementation encodes/decodes using the following rules:
- Binary data can be converted to/from either 7-bit or 8-bit encodings
- Boink is a 0 bit
- Spam is a 1 bit
- Cheese is a byte separator
- Four (or more) cheeses mark the end of file
- Whitespace (space, tab, newline) is ignored when between SBC words
Input comes from stdin and output goes to stdout. Any error messages output
on stderr. The standard command line flags are:
- -7 for 7-bit encoding [cannot be used with -8]
- -8 for 8-bit encoding [cannot be used with -7]
- -e for encode (binary to SBC) [cannot be used with -d]
- -d for decode (SBC to binary) [cannot be used with -e]
- -h for help
Examples
Command:
echo -n "Hello." | ./sbc -e
Output: (broken into separate lines)
BoinkSpamBoinkBoinkSpamBoinkBoinkBoinkCheeseBoinkSpamSpamBoinkBoinkSpamBoinkSpamCheese
BoinkSpamSpamBoinkSpamSpamBoinkBoinkCheeseBoinkSpamSpamBoinkSpamSpamBoinkBoinkCheese
BoinkSpamSpamBoinkSpamSpamSpamSpamCheeseBoinkBoinkSpamBoinkSpamSpamSpamBoinkCheese
CheeseCheeseCheeseCheese
Command:
echo -n "Hello." | ./sbc -e | ./sbc -d
Output:
Hello.
Command:
echo -n "Ninja" | ./sbc -e > ninja.txt
./sbc -d ninja.txt
Output:
Ninja
Code
We are happy to bring you the 1.0 version of SpamBoinkCheese:
sbc-1.0.1.tgz.
Compiling
Currently, there is no autoconf/configure script to detect the location
of your getopt.h header file. Compiling works peachy-keen on OS X with
Fink, but not so great with
Cygwin under windows. You may have to change the path to getopt.h in
the Makefile and/or main.c. Version 1.1 will include a configure script
so you won't have to worry about it.
Simply type "make" at the command prompt to make the app.
The final output file will be called "sbc."