Part I · Chapters I–VII
From a hand on a keyboard to the central breakthrough
It started with a hand on a keyboard
Jeremy was about to open vim and start hand-coding a prime-gap artifact detector. A tool to sniff out statistical fingerprints in compressed media and start gathering data on false positive rates. “We assume it’s low, but we don’t know.”
He took his hands off the keyboard. Not because the idea was wrong, but because the implementation would be faster with a collaborator who was, by his own admission, a better Python coder.
The initial concept: embed primes into digital media files and detect their statistical fingerprint after compression. Simple in statement. The devil was in every detail that followed.
JPEG was tripping the detector. On purpose.
The first major obstacle: JPEG’s own structure was generating prime-gap patterns that looked like embedded signals. The detector couldn’t tell the difference between a planted canary and a structural coincidence.
The fix came from an analogy to cryptography. Small primes are dangerous — Diffie-Hellman with tiny key spaces is catastrophically weak. The same principle applied here.
Drop every prime in the basket under 256. The simplest will absolutely get us in trouble. See Diffie-Hellman and how problematic it is with tiny key spaces.
This wasn’t just a parameter tweak. It was the first instance of a pattern that would repeat throughout the project: the answer was always in making the injector smarter, not the detector.
“The injector does the homework so the detector doesn’t have to.”
Rather than building an ever-more-sophisticated detector that could distinguish real signals from structural artifacts, the approach inverted: make the embedding process so well-informed that it only places markers where they’ll survive and where they can’t be confused with natural patterns.
This led to file-type profiles — JPEG, PNG, WebP, Audio — each with its own understanding of where injection targets live, what survives compression, and what the entropy landscape looks like. The embedder started doing reconnaissance before placing a single marker.
The “Douglas Rule” emerged here: a prime value only counts as a marker if it’s adjacent to a magic byte (42). If it’s not next to that sentinel, it’s not ours. Named, naturally, after the answer to life, the universe, and everything.
What if the table itself is the signal?
A question that changed the architecture: what sections of a JPEG file must be retained during compression? The answer: the DQT — the quantization table. Without it, the decoder can’t reconstruct the image.
Oh okay then let’s shift that section to its closest large prime. That’s Strategy 4.
This became Layer 1. Replace quantization table entries with nearest primes. The table itself carries the provenance signal. It must survive re-encoding because the codec depends on it. Double-quantization artifacts reveal its history.
A signal that the codec is contractually obligated to preserve.
The moment everything changed
Testing multi-generation JPEG cascades — Q95 down to Q85 down to Q75 down to Q60 down to Q40 — Jeremy noticed something that shouldn’t have been possible:
Wait wait wait, the more you try to hide through compression the more the canaries stick out?
The prime values themselves — the fuse — were destroyed by the first compression pass. That was expected. But the variance anomaly they created — the fire — didn’t just survive. It amplified.
The explanation: the markers were placed by a process that doesn’t respect spatial coherence. The natural pixels were placed by a camera that does. Compression doesn’t care about the values. It finds the structural difference and reveals it. Each quantization pass is another round of the same optimization pressure, and each round makes the anomaly more pronounced.
It is a granite block under sandstone that the ocean keeps hitting it and hitting it and hitting it. And what does it leave? The granite, not the sandstone.
This was the central breakthrough of the entire project. The perturbation is the fuse — engineering, format-specific, replaceable. The variance anomaly is the fire — physics, universal to any partition-transform-quantize system. The fuse starts the fire. The fire is self-sustaining.
The fuse is engineering. The fire is physics.
Why amplification is non-monotonic
The amplification wasn’t smooth. Some compression steps made the signal louder. Others seemed to dampen it. The pattern looked random until Jeremy’s mental model shifted:
It’s not that more compression amplifies the signal. It’s that passing over quantization boundaries is the mechanism. Like hitting nodes or antinodes when combining harmonic overtones. It’s an interference pattern, isn’t it?
Each quantization step creates a sawtooth error landscape. Marker positions cross quantization boundaries that smooth background coefficients don’t. The result is a standing wave of amplification — sometimes constructive, sometimes destructive, but on average always growing.
The moment my mental model went from “8×8 block” to “these are just specific kinds of changes over time, and each cycle is bounded, and each bounded edge behaves like a node or antinode in a wave” — it just made sense.
Three channels, eight states, a diagnostic
Testing whether RGB channels behaved independently revealed a structural insight. They don’t — JPEG converts to YCbCr color space, coupling the channels. But this coupling creates exploitable diagnostic information.
The G-B pair turned out to be the strongest detector because it lives where chroma quantization is harshest — exactly where the granite effect thrives. R-G provided independent confirmation. The failure pattern across channel pairs became diagnostic: not just “was the signal suppressed?” but “what class of operation was applied?”
Three binary channels. Eight possible states. Each state corresponding to a distinct handling history.
Neither of us would have discovered that independently. Not a chance.