Table of Contents

1. Reversible: A1Z26 (Alphabetic Position Cipher)

A=1, B=2, … Z=26. Spaces pass through. The mapping is bijective on the uppercase Latin alphabet: every letter has exactly one number, every number in [1,26] maps to exactly one letter.

(-> "HELLO"
    a1z26)
⇒ "8 5 12 12 15"

(-> "8 5 12 12 15"
    a1z26/decode)
⇒ "HELLO"

A1Z26 is the cipher behind the Little Orphan Annie decoder ring (??, ????) in A Christmas Story (??, a) ("Be sure to drink your Ovaltine"). The actual 1934 badge is more sophisticated than simple A=1: it has a permuted alphabet on the outer ring and a numbered rotating dial. The weekly radio broadcast announced the key offset. The decoder pin is literally the inverse function cast in brass.

The actual 1934 mechanism in Clojure:

(def annie-ring "AGPTBHMCSDEZVLNEJYKUWROXFIQ")

(defn annie-encode [s key]
  (->> s
       (filter #(>= (.indexOf annie-ring (str (Character/toUpperCase %))) 0))
       (map #(let [pos (.indexOf annie-ring (str (Character/toUpperCase %)))]
               (str (inc (mod (+ pos (dec key)) 26)))))
       (interpose " ")
       (apply str)))

(defn annie-decode [s key]
  (->> (clojure.string/split s #" ")
       (remove clojure.string/blank?)
       (map #(let [n (Integer/parseInt %)]
               (str (.charAt annie-ring (mod (+ (dec n) (- 26 (dec key))) 26)))))
       (apply str)))

(-> "BE SURE TO DRINK YOUR OVALTINE"
    (annie-encode 3)
    (annie-decode 3))
;; => "BESURETODRINKYOUROVALTINE"

Singh (??, a) and Kahn (??, a) cover the history of substitution ciphers in this lineage.

2. Reversible: Reverse (The Shining)

String reversal is its own inverse: (reverse (reverse s)) = s. In The Shining (??, a), Danny writes REDRUM on a door; the mirror reveals MURDER. The mirror is the inverse function.

(-> "REDRUM"
    reverse)
⇒ "MURDER"

Try it: reverse REDRUM.

In American Dad! ("Dungeons and Wagons," S2E5), the characters seek Castle Roodpart – only to realize too late that reverse("Roodpart") is trapdooR. The show doubles down: saying "Rohtaga" (reverse("Agathor")) kills Steve's character in-game, and Barry plays a wizard named Fladnag (reverse("Gandalf")). Try: reverse Roodpart, reverse Rohtaga, and reverse Fladnag.

3. Reversible: Jump-the-Five (Pager Code)

A substitution cipher on digits used by pagers and phone phreaks in the 1990s (??, a). Each digit maps to its complement across the "5 barrier" on a telephone keypad:

Input 0 1 2 3 4 5 6 7 8 9
Output 5 6 7 8 9 0 1 2 3 4

The mapping is its own inverse (an involution), like ROT13 for digits. Non-digit characters pass through unchanged.

(-> "867-5309"
    jump5)
⇒ "312-0854"

(-> "312-0854"
    jump5)
⇒ "867-5309"

4. Reversible (with escalation): Futurama Alien Languages

Futurama (??, a) shipped two alien writing systems. Alien Language 1 (AL1) is a straight substitution cipher: each alien glyph maps to exactly one English letter. Fans cracked it within days of the pilot airing by frequency analysis on background signage. It is a bijection – a lookup table.

The writers responded with Alien Language 2 (AL2), a modular-arithmetic cipher: each glyph's value depends on the sum of all preceding glyph values, modulo a fixed base. AL2 requires state (the running sum) to decode, making it resistant to naive single-character frequency analysis. It is still bijective given the initial state, but the state dependency is the arms race escalation.

The progression AL1 → AL2 maps directly to the pipeline tool's property taxonomy: AL1 is a stateless bijection (green indicator, trivially reversible). AL2 is a key-dependent bijection (amber indicator – reversible only if the initial accumulator value is known). The joke is that the writers upgraded from a morphism in Set to a morphism in a fibered category over state.

5. Reversible (escalating): Gravity Falls End-Credits Cryptograms

Gravity Falls (Disney, Alex Hirsch, 2012–2016) (??, a) embeds a cryptogram in the end credits of every episode. The show uses four cipher systems, introduced sequentially with increasing cryptanalytic difficulty — a deliberate pedagogical ladder:

Cipher Episodes Type Class Self-inverse?
Caesar (ROT-3) S1 E1–6 Monoalphabetic shift Bijection on Z/26Z No
Atbash S1 E7–13 Monoalphabetic mirror Involution on Z/26Z Yes
A1Z26 S1 E14–19 Ordinal encoding Bijection, alpha → {1..26} Yes
Vigenere S1 E20+, S2 Polyalphabetic shift Key-parameterized bijection No

All four are mathematically reversible. The puzzle design requires bijections — fans must be able to decode. The escalation pattern is the same as Futurama (AL1 → AL2) but with four steps instead of two, and the final step (Vigenere) introduces key dependency: the keyword is hidden within each episode, making it a state-dependent bijection.

The antagonist is named Bill Cipher — a two-register pun (dollar bill + cryptographic cipher), visually based on the Eye of Providence triangle. His name is itself an encoded clue to the show's central mechanic.

Episode 20 chains three ciphers in sequence: A1Z26 → Atbash → Caesar. This is exactly the pipeline tool's model: a composite recipe where each step is individually reversible, and the chain is reversible because every step is a bijection.

;; Gravity Falls S1E20 pipeline (all bijective -- green)
(-> ciphertext
    a1z26/decode       ; numbers → letters
    atbash             ; mirror the alphabet
    rot-3/decode)      ; shift back by 3
⇒ plaintext

Try a Gravity Falls–style pipeline: rot13 → hex → base64.

6. Domain-Crossing: Steganography as Pipeline

The preceding examples encode information within the same domain (text → text, digits → digits). Steganography crosses domains: the payload is embedded in a carrier signal, and the "decode" step is a domain transform (e.g. audio → image).

Aphex Twin's "Windowlicker" (??, a) and the Selected Ambient Works Volume II track "∆Mᵢ⁻¹=−α∑Dᵢ[n]" embed images in the audio frequency spectrum. The "cipher" is not a key — it is a domain transform: apply an FFT (or spectrogram) to the audio signal, and the image appears as amplitude patterns in the frequency-time plane. On the "Equation" B-side, the embedded image is Richard D. James' own face.

;; Aphex Twin spectrogram pipeline
(-> audio-signal
    fft                ; time domain → frequency domain  (bijective!)
    spectrogram        ; complex → magnitude (phase lost -- surjection)
    render-image)      ; 2D magnitude array → pixels

The FFT itself is a bijection — the inverse FFT recovers the original signal exactly. But the spectrogram discards phase information, keeping only magnitude. The pipeline is reversible through the FFT step, then irreversible at the spectrogram: you can see the face, but you cannot reconstruct the audio from the image alone.

Nine Inch Nails' Year Zero ARG (??, a) used the same technique with a different payload model. Fans spectrogram-analyzed leaked tracks expecting hidden lore and instead found a phone number — a callback to a real-world game system. The pipeline is identical (audio → FFT → spectrogram → image), but the payload is an out-of-band reference: the decoded content is a pointer, not a message. This is steganographic indirection: the pipeline's output is a key into another pipeline.

7. Irreversible: Sort (The Anagram Problem)

Sorting the characters of a string is a surjection: "hello" and "holle" both sort to "ehllo". The original ordering is gone. Recovering it is the anagram problem – given a sorted multiset of characters, enumerate all permutations that form valid words.

(-> "listen"
    sort)
⇒ "eilnst"

(-> "silent"
    sort)
⇒ "eilnst"

Both inputs collapse to the same output. The pipeline indicator turns red: the chain is now irreversible. sort is a projection from the symmetric group \(S_n\) onto the identity permutation – it forgets the permutation that produced the input.

8. Irreversible: Shuffle (Random Permutation)

Shuffling a string applies a random permutation. It is injective on a given random seed (different inputs produce different outputs) but the seed is not carried in the output, so the inverse is not computable without external state. This is the "state dependency" from Section 10's property list.

9. Composite Recipes

The most instructive pipelines mix reversible and irreversible steps. The reversibility indicator propagates through the chain:

;; Fully reversible -- green all the way
(-> "192.168.1.1"
    ipv4→int          ; "3232235777"
    hex                ; "c0a80101"
    base64)            ; "YzBhODAxMDE="

;; Reversible until sort -- then red
(-> "Be sure to drink your Ovaltine"
    a1z26              ; "2-5 19-21-18-5 ..."     ← reversible
    sort)              ; "- -   . . . 1 1 ..."   ← irreversible

;; The Shining, encoded
(-> "MURDER"
    reverse            ; "REDRUM"                 ← reversible
    rot13              ; "ERQEHZ"                 ← reversible
    base64)            ; "RVJRRVHA"               ← reversible