Hacker News front pageSimon Klee42 min readadvanced
The Farnese letter
Summary
The author reverse‑engineers a 1542 Italian cipher from a Farnese letter by combining digit‑frequency analysis with a beam‑search decoder guided by a five‑gram Italian language model, ultimately recovering the key and partial plaintext.
- A simulated‑annealing outer loop searches for letter‑to‑digit assignments while an inner beam search resolves ambiguous code boundaries.
- Training a 5‑gram model on contemporary Italian texts (Machiavelli, Castiglione, etc.) provides a probabilistic scoring function for candidate decodings.
- The recovered key maps 18 letters to one‑ or two‑digit codes, revealing phrases like “Dopo la partita del Montepulciano”.
- Digit‑pair statistics (e.g., frequent pairs 80, 57) and the avoidance of doubles guided the design of the search space.
Historians and cryptographers can apply this data‑driven approach to other unsolved early modern ciphers.
8/10


