June 6, 2026
Cryptographic Experiments No. 1 — Time As Cryptography Itself
For some time, I’ve been wanting to start deep-diving into advanced cryptography things. I feel like, even if I’m as familiarized with it…
Edgar Huemac Sanchez Hernandez
4 min read
For some time, I've been wanting to start deep-diving into advanced cryptography things. I feel like, even if I'm as familiarized with it as a whole, as much as any infosec person is, I had the feeling that I couldn't really put a hammer to a nail when it comes to modern cryptographic things.
After years grinding through red team ops, malware things, and dissecting some of the mainstream crypto primitive, I got bored with the sterile perfection of AES, ChaCha, and the usual suspects. They work. They're solid. But they're also… predictable. As oposed to the primitive and ancient encryption that we learn from history and 101 security courses, current advanced crpytpgraphy feels, at least to me, corporate and soulless.
So I started to experiment with it… maybe it was just that I was too dumb to understand modern crypgohraphy beauty? So I started to experiment. I'd take a simple Feistel network and shove logistic maps into the round function. I'd seed RC4 with weird entropy sources just to watch it burn. I mixed oscillators into S-box generation, injected hardware timing jitter into key scheduling, and generally violated every clean design principle in the book. Most of it (if not all) was garbage. Slow, broken, or trivially crushable. But every failure taught me something.
That garbage is fun!
So I wanted to build cryptographic things that felt more alive. Thus, this "Cryptographic Experiments" blog series was born. Again, just for myself, as I don't really expect anyone to read this anyway. So, today's main concept: what if time itself became a core cryptographic primitive?
Not just a nonce or IV, but a chaotic force that warps the entire encryption process. The exact nanosecond you press encrypt literally changes the S-boxes, the number of rounds, the diffusion paths… everything! One microsecond later and the ciphertext is a completely different animal. Every encryption becomes a unique snapshot of the universe at that precise moment (kind of uuid's, but a bit more complex, and so much more fun). Thus was born the Kairos Entanglement Cipher — my first histeria letter to "advanced" cryptography, chaotic systems (fun!), time, and doing cryptography for the sheer hell of it. But mainly, this is me throwing weird ideas at the wall until something that I thought was somewhat cool stuck.
The spark
Most ciphers are usually deterministic. Same key + same plaintext = same ciphertext forever. Time-lock puzzles go the other way (delaying decryption), so I thought: what if the moment of encryption became a chaotic attractor that mutates your S-boxes, permutations, round count, and diffusion? Tiny differences in time (microseconds) explode into completely different ciphertexts thanks to sensitivity to initial conditions. Of course, I didn't think of it out of nothing… I kind of tried to mix my favorite flavors to come up with a new cake, that might have disgusting flavor but meh.
KEC is a hybrid SPN-Feistel construction driven by a Lorenz attractor seeded with your master key + high-precision timestamp.
First, we have a "temporal seeding" process. At encryption time we grab:
Then compute the master temporal seed:
Then the fun part (yes, unnecessary maybe, but fun): Now we integrate the chaotic engine (base algorithm was thought with the Lorenz equations, however I think any other would be the same).
With parameters σ = 10, ρ = 28 and β = 8/3 for a classic chaotic regime. Also, I discretize it with Euler integration and extract fractional parts to build:
- Dynamic 256-element S-boxes (Fisher-Yates style shuffle driven by chaos)
- Byte permutations
- Round subkeys
- Variable round count: R = 16 + ( T mod 8 )
Then, after each round we inject a slice of the original timestamp:
This creates deep dependencies. Wrong timestamp (even slightly) makes decryption explode into garbage because the chaotic trajectories diverge exponentially. Very cool, right? But, how does it really work?
Encryption flow (simplified):
- Capture T T T at nanosecond precision
- Generate chaotic sequence from Lorenz
- Build dynamic S-box + permutation table
- For each block:
- Whitening with chaotic round key
- For R rounds: — Substitution (dynamic S-box) — Chaotic diffusion (add modulated values) — Permutation — Key addition — Temporal entanglement fold
- PKCS7 padding + simple timestamp MAC in header
Decryption reverses everything using the same T (transmitted in the header, authenticated with the master key). Because of the chaos, even 1μs difference in T creates a completely different cryptographic path.
I started with simple logistic maps (too weak and boring). Switched to Lorenz + multiple dimensions. Better, but floating point precision can bite you (something to harden in future versions if any?). The current Python prototype is minimal and self-contained, with no dependencies. Runs fast enough for playing.
Why this kind of matters (to me)
This isn't meant to replace AES. It's an artistic experiment, maybe, but implemented as a practical solution. A proof that cryptography can still be weird, personal, and fun.
The timestamp makes every encrypted message a unique fingerprint of a specific moment in time. Re-encrypt the same file a second later and you get radically different ciphertext. I still have a couple more ideas to implement to this (maybe in future commits?) but for now, if you want to check it out at my Github repo.
Also, if you want to know more, I really enjoyed these references:
- Lorenz System & Chaos Theory Foundations
- Chaotic Cryptography Surveys & Reviews
- Advanced Lorenz-based Encryption Schemes
- Time-Based / Temporal Cryptography
Anyway, thanks for staying. Next blog will be about malware development for sure. See ya!