Munge: Forging Mango’s Adaptive Cryptography
This article builds on the original post, Mango: An Adaptive Cryptographic System, which introduced the core architecture of Mango and presented its performance benchmarks.
In the follow-up, The Heart of Adaptive Cryptography, we explored how Mango adapts its encryption behavior to the data it processes — selecting the right transforms and tuning rounds based on the input’s characteristics.
In this final installment, we turn our focus to the engine behind that adaptivity: Munge.
This is where the magic begins — where raw transform concepts are tested, evaluated, and forged into the optimized sequences that power Mango’s adaptive cryptography.
We’ll unpack how Munge works, why it matters, and how it continuously refines Mango’s capabilities through iterative discovery.
If Mango adapts to the input — it’s Munge that teaches it how.
🔹 The Possibilities Are Endless
Mango comes stocked with 40 atomic transforms — small, self-contained operations that modify data streams in unique ways. Each transform accepts a stream of input, alters it according to its logic, and passes the result downstream. These transforms are chained together to form a pipeline, producing an encrypted output.
In Mango, every encryption is defined by four key variables:
- Which transforms are used
- How many transforms are used (sequence length)
- The order in which those transforms are arranged (order matters!)
- How many times each transform (or the whole sequence) is repeated (rounds)
Through extensive testing, I’ve discovered that encryption quality and strength peak at around five transforms per sequence. Beyond that, additional transforms often offer diminishing returns — and in some cases, even reduce cryptographic quality due to overfitting or destructive interference.
🔢 The Math
So, how many different sequences can we build using Mango’s 40 transforms — if we allow lengths from 1 to 5, and allow repeated transforms within a sequence?
We’re looking at the sum of permutations:
That’s over 105 million possible sequences — and that’s still before considering input types or per-transform tuning.

Out of the box, Mango supports four distinct input profiles — each with its own characteristics and challenges:
- 📚 Natural — Structured text, HTML, human-readable content
- 🎲 Random — High-entropy, pseudorandom input
- 📈 Sequence — Predictable, low-entropy patterns
- 🧬 Combined — Real-world blends of structure and noise
Each of these profiles required its own tailored sequence discovery process.
So the total Munge search space isn’t just 105,025,640 sequences…
It’s:
105,025,640 × 4 = 420,102,560
That’s over 420 million transform sequences to evaluate — before rounds, before scoring, before tuning.
This is why Munge doesn’t just help — it’s essential.
🔥 Enter Munge
Faced with this staggering search space, how do we find the few golden sequences that truly maximize cryptographic strength?
That’s where Munge comes in.
It’s Mango’s internal discovery engine — a high-throughput, multi-threaded, feedback-aware evaluator that systematically explores transform combinations at scale.
Munge evaluates millions of potential sequences in parallel, scoring each one using a comprehensive battery of metrics — entropy, avalanche behavior, key dependency, and more. It then refines and evolves toward the best-performing candidates through iterative rounds of testing.
This is where Mango becomes more than the sum of its parts.
Munge transforms raw components into a hardened cipher — forged, not just built.
So when you see a seemingly simple profile being fed into CryptoLib.Encrypt() like this:
{ "Combined", new InputProfile("Combined", new (byte, byte)[]
{
(8, 3), // ButterflyTx
(10, 1), // SubBytesXorMaskInvTx
(31, 1), // ButterflyWithRotationFwdTx
(9, 1), // SubBytesXorMaskFwdTx
(31, 1) // ButterflyWithRotationFwdTx (again)
}, 6) }
Just know:
This wasn’t handpicked. It wasn’t guesswork.
It was likely the result of a week’s worth of Munging — hundreds of millions of candidates tested, scored, and tuned — all to produce a sequence that looks unassuming, but performs at the cryptographic edge.
Comments welcome—especially from researchers, engineers, and anyone working with large or domain-specific data.
🔗 GitHub: https://github.com/Luke-Tomasello/Mango-Adaptive-Cryptographic-System
