DEV Community

StoneVast
StoneVast

Posted on

I built a base-13 cipher. It failed my first test — then 169 empty slots fixed it

I built a base-13 cipher. It failed my first test — then 169 empty slots fixed it

Part 3 of the transparent-mining workbench series. Today: the cipher lab attached to it, where I test ideas and publish the results — including the failures.

The idea: base-13

Take the 26-letter alphabet and merge pairs: a≡b, c≡d, ... y≡z. You get 13 symbols. Each base-13 symbol carries log₂13 ≈ 3.70 bits vs 4.70 bits for a letter — a 21.3% information loss per character.

My hypothesis: that loss would blur the frequency signature and make the ciphertext harder to frequency-analyze than a classic substitution cipher.

Test 1: hypothesis falsified

I encrypted a 714-character English corpus and ran a chi-square flatness test (lower = flatter = harder to crack):

Cipher Symbols χ²/symbol Verdict
Caesar shift (26) 26 21.65 breaks instantly
Base-13 merge 13 18.24 only 16% flatter

The dominance of 'e' simply propagates into its merged slot (e/f inherits e's 12.7% frequency). Frequency structure survives the merge. Hypothesis dead. Negative result, published anyway — that's the rule of this lab.

Test 2: flipping the direction

If losing information doesn't hide frequency, what about spreading it?

Base-13 gives me 13×13 = 169 two-digit symbol slots. Only 26 are needed for the alphabet. That leaves 143 empty slots — so I assigned slots proportional to English letter frequency: e gets 18 slots, t gets 15, a gets 14, down to 1 each for q and z. During encryption, each plaintext letter picks a random slot from its pool.

Same corpus, same test:

Cipher Symbols χ²/symbol Verdict
Caesar shift (26) 26 21.65 breaks instantly
Base-13 homophonic 169 1.26 statistically indistinguishable from uniform

17× flatter than Caesar. A χ²/symbol under 2 means an analyst can't tell the distribution from random noise. Frequency analysis has nothing to grab.

The honest fine print

  • This is the classic homophonic substitution cipher — invented centuries ago, broken by smart people since. I'm not claiming novelty; base-13 is just a clean new carrier for it.
  • The key is the slot table — equivalent in strength to a single-table key. This is a teaching sample, not modern crypto. AES is not worried.
  • Cost: ciphertext doubles (2 base-13 digits per letter).
  • The real lesson: information hides by spreading, not by shrinking. Compression (merging) failed; expansion (169 slots) worked.

Why a mining workbench has a cipher lab

Same philosophy as the mining rig: small, transparent, fully reproducible. The DAG in FishHash — the algorithm my GPU mines — is also deterministic expansion: a tiny seed deterministically expands into a 4.6GB dataset. My base-13 parent cipher and FishHash's DAG are two faces of one idea: small seed, big world.

That's the paper I'm writing. Every experiment, including the falsified ones, is public.

Live numbers + code: https://haolinsong32-lang.github.io/stonevast/


Previous: I withdrew $0.24 of mined crypto to an exchange

Top comments (0)