Skip to content

feat(ciphers): add Josse - #5

Merged
0xdiid merged 1 commit into
mainfrom
feat/josse-cipher-clean
Jul 30, 2026
Merged

feat(ciphers): add Josse#5
0xdiid merged 1 commit into
mainfrom
feat/josse-cipher-clean

Conversation

@0xdiid

@0xdiid 0xdiid commented Jul 30, 2026

Copy link
Copy Markdown
Owner

No description provided.

@0xdiid
0xdiid force-pushed the feat/josse-cipher-clean branch from f346fad to fb6b407 Compare July 30, 2026 14:04
…abet

Josse (Maj. H. D. Josse, French Army, ~1889) is absent from the ACA registry and
from every hobbyist tool surveyed, so it was a genuine gap. Spec recovered by
Géraud-Stewart & Naccache (Cryptologia 45(4), 2021); broken ciphertext-only from
~75 letters by Lasry (Cryptologia 47(1), 2023).

  C_1 = let(-num(P_1));  C_i = let(num(P_i) + num(C_{i-1}))

with num()/let() the position map of a keyword-derived mixed alphabet (written
row-wise into a table, read back column-wise). Decryption is a first difference.

Adds:
* encode/decode for the 26-letter generalisation (default) and the historical
  25-letter form (drop="W")
* keyless two-stage crack: at the correct numbering the difference sequence
  D_i = num(C_i) - num(C_{i-1}) IS a monoalphabetic image of the plaintext, so
  stage 2 reduces to a simple-substitution solve
* Josse.digraph_ioc — a mono-invariant statistic that identifies a candidate
  numbering (~150-letter sample: true 4.12 vs random 1.08 +- 0.23, z +13.3)
* full spec and computationally verified test vectors in docs/cipher-specs.json
* 6 tests, including the mono-invariance the attack depends on

Measured caveat, recorded in the module and the spec: free 26!-alphabet search is
overfit-undecidable at short lengths. Maximising unigram IoC overfits (a wrong
numbering reaches 2.32 vs a true 1.89); sorted-profile matching is too coarse; and
even digraph IoC — an excellent TEST — is beaten by free search (9.42 vs 4.12).
The practical attack sweeps the KEYWORD space, which is dictionary-sized rather
than 26!, and recovers planted keys exactly.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01UrpA9d1jGn7fzbB1aV61JK
@0xdiid
0xdiid force-pushed the feat/josse-cipher-clean branch from fb6b407 to fdbadd1 Compare July 30, 2026 14:05
@0xdiid
0xdiid merged commit 27c36ea into main Jul 30, 2026
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant