A validation suite for binary-in-text encoding patterns, from uuencode (1980) to org-mode babel blocks (2026). Every encoding claim is an executable round-trip test.
Codex Wallerstein (c. 1470) — the Mordhau technique. Binary data, like a sword, must sometimes be disguised to pass through hostile channels.
Foundational Axiom: A binary artifact must survive transit through a channel that only tolerates text.
Every encoding system solves the same constraint:
- 7-bit SMTP channels reject 8-bit bytes
- Text editors corrupt binary data
- Patch utilities expect printable ASCII
- Email headers have strict character limits
The solutions all converge on the same structure:
┌─────────────────────────────────────────┐
│ HEADER name / type / encoding hint │
│ PAYLOAD ascii-safe encoded bytes │
│ FOOTER end marker / checksum │
└─────────────────────────────────────────┘
| Year | Format | Channel Constraint | Overhead |
|---|---|---|---|
| 1980 | uuencode | UUCP / 7-bit email | ~37% |
| 1983 | BinHex | Mac resource forks | ~35% |
| 1987 | PEM/Base64 | Privacy-Enhanced Mail | ~33% |
| 1989 | XBM/XPM | X11 icons/cursors (C source) | ~400% |
| 1990 | X-Face | Pine/Mutt/Gnus email faces | custom |
| 1985 | Ascii85 | PostScript/PDF (btoa) | ~25% |
| 1992 | MIME Base64 | RFC 2045 email | ~33% |
| 1998 | data: URI | RFC 2397 web embedding | ~33% |
| 2005 | Git binary | Patch files | ~25% |
| 2018 | org-mode | Literate programming | ~33% |
| Year | Format | Channel Constraint | Spec |
|---|---|---|---|
| 2000 | SOAP base64 | XML text | xs:base64Binary |
| 2005 | MTOM/XOP | SOAP + MIME attachment | W3C (avoids base64 overhead) |
| 2013 | JSON Schema | JSON text | contentEncoding + contentMediaType |
| 2017 | OpenAPI 3.0 | REST API response | format: byte / binary |
| 2021 | OpenAPI 3.1 | REST API response | JSON Schema contentEncoding |
// JSON Schema for base64-encoded PNG
{
"type": "string",
"contentEncoding": "base64",
"contentMediaType": "image/png"
}| Year | Format | Channel Constraint | Notes |
|---|---|---|---|
| 1977 | XMODEM | Serial/modem (async) | 128B blocks, checksum |
| 1985 | YMODEM | Serial/modem (async) | 1K blocks, batch mode |
| 1986 | ZMODEM | Serial/modem (async) | Streaming, Ctrl-char escape |
| 1988 | SLIP | Serial line (IP) | END=0xC0, ESC=0xDB framing |
| 1994 | PPP | Serial line (IP) | HDLC 0x7E framing, 0x7D esc |
| Year | Format | Channel Constraint | Notes |
|---|---|---|---|
| 1976 | Kansas City Std | Cassette tape (audio) | 1200/2400 Hz FSK |
| 1980 | BASICODE | Radio broadcast (Netherlands) | NOS/BBC/WDR/DDR |
| 1963 | NOAA APT | VHF radio (137 MHz) | TIROS-8 weather sat |
| 2020 | LoRa/Meshtastic | Sub-GHz radio (900 MHz) | Text over mesh networks |
| 2024 | NASA DSOC | Laser (1550nm optical) | Deep space optical comm |
Gladiatoria (c. 1430) — armored combat. Like knights donning armor, binary data dons ASCII encoding to survive hostile text channels.
spec.org— Literate test suite (the spec is the tests)bin/check-prereqs.sh— Tool availability checkbin/test-*.sh— Round-trip tests for each encodingelisp/display-helpers.el— Org-mode inline image supportMakefile— Tangle and test runner
# Clone
git clone https://github.com/aygp-dr/ascii-armor.git
cd ascii-armor
# Check prerequisites
make prereq
# Generate fixtures and run tests
make test
# Or execute the entire spec in Emacs
make test-orgBase system (already installed):
uuencode/uudecodeb64encode/b64decodexxd
Packages:
pkg install git # Required
pkg install sharutils # Optional: GNU shar
pkg install ImageMagick7 # Optional: XBM/XPM conversionSee INSTALL-FREEBSD.md for details.
Every #+begin_src block in spec.org is executable via C-c C-c.
If it cannot be executed, it is marked :eval no.
For each encoding, the test is:
encode(decode(encode(x))) == encode(x)
Partial coverage (encode only) is not sufficient.
Every shell block verifies tools are on PATH before use. Missing tools produce structured JSON errors, not silent failures.
Open hypotheses are tracked and testable:
| ID | Hypothesis | Refutation |
|---|---|---|
| C-001 | All required tools in FreeBSD 14 base | check-prereqs exits 2 |
| C-003 | uuencode overhead ~37% | measured < 35% |
| C-009 | Ascii85 overhead ~25% | measured > 27% |
| C-011 | compface not in FreeBSD ports | pkg install succeeds |
ascii-armor/
├── spec.org # Literate test suite (source of truth)
├── CLAUDE.md # Agent instructions
├── Makefile # Build/test runner
├── INSTALL-FREEBSD.md # Package installation guide
├── bin/
│ ├── check-prereqs.sh # Tool availability check
│ ├── test-uuencode.sh # uuencode round-trip
│ ├── test-b64encode.sh # base64 round-trip
│ └── ...
├── elisp/
│ └── display-helpers.el
├── resources/
│ ├── codex-wallerstein-107v.jpg
│ ├── gladiatoria-kk5013-28v.jpg
│ └── SOURCES.md
└── archive/
└── spec-v1-*.org # Previous spec versions
- uuencode (Wikipedia)
- RFC 2045 (MIME)
- RFC 2397 (data URI)
- XBM (Wikipedia)
- Ascii85 (Wikipedia)
- Org Babel Manual
- Kansas City Standard (Wikipedia)
- BASICODE (Wikipedia)
- NOAA APT Reception (RTL-SDR)
- JSON Schema: contentEncoding
- OpenAPI 3.1 Specification
- MTOM/XOP Binary Optimization
MIT
Medieval fencing manuscripts from Wikimedia Commons (public domain):
- Codex Wallerstein (c. 1470) — Universitätsbibliothek Augsburg
- Gladiatoria Ms. KK5013 (c. 1430) — Kunsthistorisches Museum Vienna