Chaos in the Coordinates: How the Hailstone System Uses the Collatz Conjecture for Cryptography

Hero

Published on May 05, 2026

Have you ever looked at a simple mathematical puzzle and wondered if it could be used to hide secrets?

In 1937, German mathematician Lothar Collatz proposed a deceptively simple sequence. Take any positive integer. If it is even, halve it. If it is odd, triple it and add one. Repeat. Despite decades of effort by some of the world's finest minds, no one has been able to prove that every single starting number eventually drops down to the number 1. Because the numbers in this sequence bounce up and down unpredictably before falling to Earth, they are commonly called hailstone numbers.

While mathematicians treat the Collatz Conjecture as a frustrating mountain yet to be climbed, cryptography sees it as something else entirely: a source of beautiful, non-linear chaos.

Enter the Hailstone System v4.1, an experimental framework created by John T. Harrison that turns this classic mathematical riddle into a recursive cryptographic engine.


The Mathematical Engine: Why Hailstones Don't Line Up

Standard ciphers often rely on predictable linear shifts. If you are using a simple Caesar cipher with a shift of 2, "A" (ASCII 65) becomes "C" (67), and "B" (ASCII 66) becomes "D" (68). The structural relationship between the characters remains completely intact, leaving the door wide open for frequency analysis.

The Hailstone System breaks this relationship entirely through Non-Linear Divergence.

If we process the letter "A" (which we map to a starting value of 102) through the Collatz algorithm for a few steps, its value collapses quickly:

102 → 51 → 154 → 77 → 232

But if we process "B" (starting value 103), the math immediately explodes:

103 → 310 → 155 → 466 → 233 → 700

A difference of just 1 in the initial input leads to vastly different numerical destinations. This extreme sensitivity to initial conditions is the cornerstone of chaos theory—and it makes pattern recognition incredibly difficult for an eavesdropper.


Behind the Curtain: Three Clever Engineering Tricks

To turn this mathematical curiosity into a secure, functional cipher, the Hailstone System introduces three clever structural mechanisms.

1. The Key-Dependent Fingerprint Hash

If multiple plaintext letters ended up on the same mathematical path, they would eventually converge to the same numbers, leaking patterns. To prevent this, the system calculates a unique "Fingerprint" for every single character.

It takes the result of the Collatz process, scales it up, and then appends a unique signature based on the letter's position in the message and the rotating key's ANSI value:

Output = (Collatz Result × 1000) + (Letter Position + Key ANSI)

Because of this "tail," the exact same letter will yield a completely different encrypted integer every time it appears in your message.

2. In-Band Signaling via the "Key Fence"

How do you share an encrypted message without having to send the decryption key in a separate, easily lost channel?

The Hailstone System solves this with a structural "Key Fence" using the arbitrary boundary number 999999. Everything before this number is the encrypted stream of hailstone values. Everything after it represents the raw ANSI codes of the key. This makes the payload completely self-contained and portable.

[ Encrypted Numerical Stream ] ---> [ 999999 (Fence) ] ---> [ Raw Key ANSI Codes ]

3. Punctuation & Key Rotation Alignment

In rotating key systems (like the Vigenère cipher), non-alphabetic characters like spaces and full stops can easily throw the key alignment out of sync if not handled carefully.

The Hailstone System uses Negative ANSI Mapping. When it encounters a space, comma, or period, it simply stores it as a negative integer (e.g., a space becomes -32) and skips rotating the key. This ensures the decryption engine always stays perfectly aligned with the key, no matter how much punctuation you use.


Measuring the Chaos: What is BiEntropy?

How do we actually prove that this mathematical soup is secure? We measure its randomness using BiEntropy (a concept formalised by researcher Grenville Croll in 2020).

While standard Shannon entropy measures the overall spread of characters, it can be fooled. A highly ordered, repeating pattern like 01010101 might register as highly chaotic to a basic test.

Raw Ciphertext ---> Convert to Binary String ---> Calculate Successive Derivatives ---> Weigh and Average Shannon Entropy

BiEntropy goes a step deeper. It converts the ciphertext into a binary stream and repeatedly calculates its "derivatives" (the differences between adjacent bits). By checking the entropy of these successive layers, BiEntropy easily spots hidden order and periodic patterns. If the BiEntropy score remains close to 1.0, it proves the system is behaving with true, unpredictable chaos.


Try It Yourself

Ready to see recursive chaos cryptography in action? You can experiment with the algorithm, encrypt messages, and decrypt incoming streams directly through our web-based interface.

  • Run the Live Demo: Experience the interactive email client rendition here


  • Explore the Code: Check out the reference implementation, review the mathematical logic, and spin up your own local server via the GitHub Repository.


The Takeaway

The Hailstone System serves as a brilliant reminder of a fundamental truth in security: complexity does not require overly complicated ingredients. By taking a simple, unresolved math puzzle from 1937 and combining it with basic modular math, we can create a dynamic, unpredictable cryptographic environment that keeps modern eavesdroppers guessing.

John Harrison

Lead Engineer

Back to Blog