Voynich Master Archive - Volume 04 - Pages 3001-4000
French Verne control text at the start of the file. Later pages are other control texts, workspace supplements, table previews, and a closing report.
PDF page 493 of 1000. Catalog page range 3001-4000.
Extracted text
Voynich Complete Reproducibility Compendium - 2026-08-28 Page 3492
archive/local/external_voynich_units/voynich_decipherme
nt_repro_bundle/decipherment_attack_v6/run_differential
s.py
SHA-256: ae047ec0724b2d0cc28c5df7434f671e9d58b198f9828cf79df21c54d6659942 | 8,601 bytes | workspace supplement
#!/usr/bin/env python3
"""Real-minus-surrogate language-match differentials for the five synthetic
homophonic ciphers of validate_synthetics.py, over several seeds.
For each configuration (H2, H3, H5, H3mix, H3rot) and each seed s:
1. build the synthetic ciphertext exactly as validate_synthetics.py does
(make_tables + encipher + truncate), but with the cipher RNG re-seeded to
``20260809 + s`` immediately before the configuration is built, so that
every (config, seed) cipher is reproducible on its own (seed 0 of H2 is
therefore byte-identical to the H2 cipher of validate_synthetics.py, whose
module RNG is fresh when H2 is built);
2. build the matched order-3 surrogate of that ciphertext with
attack_voynich.ngram_generate (seed 7 + s), i.e. the same negative control
that attack_voynich.py applies to Voynichese;
3. push both streams through the identical pipeline (BPE k -> 22 Brown
classes -> near-bijective substitution attack, restarts=8, attack seed s)
against the Latin held-out LM (right language) and the German LM (wrong
language), and record the language-match index of each;
4. differential = index(real) - index(surrogate), per language.
Output: output/differentials.json with per-seed values and per-config
mean/min/max of the differential (Latin and German). Nothing else in
output/ is touched.
Usage (from this directory):
python3 run_differentials.py [--seeds 0-4] [--restarts 8] [--workers 5]
"""
from __future__ import annotations
import argparse
import json
import os
import random
import sys
import time
from multiprocessing import Pool
from pathlib import Path
HERE = Path(__file__).resolve().parent
sys.path.insert(0, str(HERE))
import validate_synthetics as vs # noqa: E402
from attack_lib import build_lms, match_index, pipeline_classes, truncate # noqa: E402
from attack_voynich import ngram_generate # noqa: E402
OUT = HERE / "output"
LANGS = ("latin_holdout", "german")
CIPHER_SEED_BASE = 20260809 # validate_synthetics.py module RNG seed
SURROGATE_SEED_BASE = 7 # attack_voynich.ngram_generate default seed
CONFIG_ORDER = ["H3", "H2", "H5", "H3mix", "H3rot"] # priority order
_STATE: dict = {}
def _init_worker():
"""Per-process setup: LMs and the Caesar plaintext lines."""
_STATE["lms"] = build_lms(list(LANGS))
base = vs.caesar_lines()
freq = vs.Counter(c for ln in base for w in ln for c in w)
_STATE["base"] = base
_STATE["letters"] = [c for c, _ in freq.most_common()]
def build_cipher(name: str, seed: int):
"""Synthetic ciphertext for config `name`, cipher RNG seeded per (config, seed)."""
cfg = next(c for c in vs.CONFIGS if c[0] == name)
_, n_var, lens, choice = cfg
vs.rng = random.Random(CIPHER_SEED_BASE + seed) # make_tables/encipher read vs.rng
tab = vs.make_tables(_STATE["letters"], n_var, lens)
clines, _prov = vs.encipher(_STATE["base"], tab, choice)
clines = truncate(clines, vs.TARGET)
n_groups = n_var * len(_STATE["letters"])
k = 110 if n_groups > 80 else 64
return clines, k, n_groups
def run_task(args):
name, seed, restarts = args
if not _STATE:
_init_worker()
t0 = time.time()
clines, k, n_groups = build_cipher(name, seed)
surrogate = ngram_generate(clines, seed=SURROGATE_SEED_BASE + seed)