Skip to content

Repository files navigation

Cipher Lab

CI License: MIT Python 3.12+ uv

Reproducible research harness for solving and studying historical ciphers and encrypted texts.

Open computational investigations of historical cryptograms: hypotheses, experiments, failed approaches, and results you can re-run from a clean checkout. This is research software (preview maturity), not a product launch.

Interactive essay: lessthanzero.github.io/cipher-lab


Why it exists

Classical cryptanalysis of short historical texts is easy to overfit. Cipher Lab keeps observations, candidate keys, negative controls, and multiplicity-corrected trial counts in one place so claims stay auditable.

Sibling labs:


Research cases

Case Subject Status (landing summary) Details
CASE-001 D’Agapeyeff (1939) Best current reconstruction under active peer review project
CASE-002 Dorabella (1897) Structurally characterized; English-prose monoalphabetic routes largely exhausted project
CASE-003 Shugborough (OUOSVAVV) Unicity-bounded; Latin initialism model preferred over popular myths project
CASE-004 Kryptos K4 (1990) Plaintext known via 2025 archival recovery; decryption method unverified case

Also in-tree (see project folders): Rohonc Codex liturgical tachygraphy track, Indus structural experiments, Qumran cryptic / Biblical Atbash probes.

Landing language is deliberately cautious. Full mathematical claims, plaintext editions, and errata live in project READMEs and SCIENTIFIC_LIMITATIONS.md.


One concrete experiment (CASE-001)

The D’Agapeyeff textbook challenge (392 digits) remained open for decades after the author lost his own keying notes. This lab couples prior community observations (14th-column anomaly, diagonal reflection, Two-Square baselines) with a deterministic reconstruction pipeline and negative-control shuffles.

Reproduce from a clean checkout:

uv sync --all-packages --group dev
uv run pytest tests/test_dagapeyeff.py -q
uv run python -m projects.dagapeyeff.exact_14key_sweep

See cases/CASE-001-dagapeyeff.md for inputs, constraints, and verification notes.


Methods

  • Epistemic partitions — observations, transcriptions, candidate keys, and falsifications stay separated.
  • Unicity gate ($U_0$) — if payload length $N < U_0$, single-key optimization is rejected.
  • Statistical gating first — IC, entropy, quadgrams, permutation tests before any LLM referee.
  • Append-only ledger — DuckDB trial denominator for multiplicity correction (local artifact under data/derived/).
  • Negative controls — shuffles / foils required when claiming linguistic viability.

Optional distributed compute (homelab Fedora worker) and LLM double-blind refereeing exist for heavy sweeps; they are not required for the quickstart or CI.


Reproduction

Requirements: Python 3.12+, uv.

git clone https://github.com/lessthanzero/cipher-lab.git
cd cipher-lab
uv sync --all-packages --group dev
uv run pytest   # 161 tests

Tracked corpora live under data/corpora/ and data/indus/. Heavy derived artifacts (data/derived/, *.duckdb) are gitignored and regenerated by project runners.

Per-case reproduce commands: cases/.


Results & documentation


Contributing

See CONTRIBUTING.md. Useful contributions: reproduction reports, failed experiments with controls, corpus corrections, and new case stubs that obey the unicity / negative-control rules.


Support the research

Independent open-source historical cryptanalysis. Funding links will appear here once GitHub Sponsors (or similar) is enabled — nothing essential is gated.


Acknowledgements

Built on community cryptanalysis:

  • Erik van Eykelen (@hackteck) — 14th-column anomaly (D’Agapeyeff)
  • Tim Marland (dagapeyeffresearch.com) — Two-Square / computational baselines
  • Nick Pelling (ciphermysteries.com) — diagonal reflection hypothesis
  • Viktor Wase — Dorabella non-monoalphabetic annealing bounds
  • Levente Zoltán Király & Gábor Tokai; Benedek Láng — Rohonc codebook / codicology