# Z32 identifiability: how often does ordinary English fit the cipher's equality pattern? (item corpus-rate) Batch e04-identifiability, item corpus-rate. This is a measurement of English text, not an attempt to decrypt. **No plaintext here is proposed as a solution.** The two corpus windows quoted below are examples **constructed** by the measuring script from a novel. They show what a match looks like and nothing else. ## 1. Inputs | Input | Value | Source | |---|---|---| | Z32 ciphertext, positions 1..32 | `C9J|#Ok[AMf8?ORTGX6FDVj%HCELzPW9` (each character stands for a handwritten glyph) | Given in the brief. I did not re-transcribe the glyphs. | | Glyph counts | 29 types: 3 appear twice (positions 1&26, 2&32, 6&14) and 26 appear once | Given in the brief. I checked it against the string above: pos 1 = pos 26 = `C`, pos 2 = pos 32 = `9`, pos 6 = pos 14 = `O`, and all other characters are distinct. Cipher Mysteries also says three shapes appear twice. That page refused my scripted fetch, so it is not in sources.json. | | Z32 context | 32-character cipher ending the June 26, 1970 letter. Never definitively decoded. | Wikipedia, "Zodiac Killer", section "June 1970 letter and map": https://en.wikipedia.org/wiki/Zodiac_Killer | | Route pairs | Positions 1&6, 24&25, 27&31 (a published route puts the same glyphs there) | Given in the brief. **I did not find the publication that proposes this route**, so it is uncited here. | | FBI Laboratory, July 1970: "26 different symbols" | Taken from the brief. The brief's merge for reaching 26 types: 5=24, 12=2=32, 11=20 | **I could not find this FBI worksheet online.** The figure and the merge are the brief's. The brief itself says the worksheet does not name which symbols were merged. | | English corpus | Leo Tolstoy, *War and Peace*, translated by Louise and Aylmer Maude, Project Gutenberg eBook #2600 ("Most recently updated: June 14, 2022"). Fetched from the PG mirror https://gutenberg.pglaf.org/2/6/0/2600/2600-0.txt (3,359,405 bytes, sha256 `e4bcf9042609b62c7de72a6f1b311f54c412943a9d641b7efcf79a464b5f31c8`). The main site www.gutenberg.org/ebooks/2600 was down for maintenance at the time. | Header of the file: "Translators: Louise and Aylmer Maude". It is public domain in the US per the PG header. | | Corpus size after cleaning | **2,506,248 letters** A-Z (meets the 1,000,000 minimum) | Computed below | | Entropy rate h | 1.0, 1.3 and 1.5 bits per letter | See section 2 | ## 2. Sources for h (bits per letter) - **h = 1.3**: this is Shannon's upper bound and also the Cover and King figure. M. Mahoney, "Rationale for a Large Text Compression Benchmark", section "How Much Compression can be Achieved?", http://mattmahoney.net/dc/rationale.html: Shannon estimated "the entropy bounds to be between 0.6 and 1.3 bits per character (bpc) using a 27 character" alphabet, and Cover and King concluded "that the entropy of Shannon's material was at most 1.3 bpc." Wikipedia "Entropy (information theory)" (https://en.wikipedia.org/wiki/Entropy_(information_theory)) says the same: "English text has between 0.6 and 1.3 bits of entropy per character of the message." - **h = 1.0**: same Mahoney section: "the actual value is near the middle of the Shannon bounds, about 1 bpc". - **h = 1.5**: **I found no fetchable source that states 1.5 bits per letter.** Search results attributed about 1.46 bpc to a compression-based estimate by Teahan and Cleary, but I could not open a primary page to confirm it. Treat 1.5 as an upper sensitivity value of the brief's own choosing, not a sourced estimate. These estimates are for long English text, mostly on a 27-symbol alphabet (letters plus space). A 32-letter message without spaces has its own entropy, which is not well measured (see Assumptions). ## 3. Method (enough to rerun) 1. Download `2600-0.txt` (check the sha256 above). Keep only the text between the line `*** START OF THE PROJECT GUTENBERG EBOOK ...` and `*** END OF THE PROJECT GUTENBERG EBOOK`, so the PG licence is excluded. 2. Upper-case the text and delete every character outside A-Z. That includes spaces, punctuation, digits and accented letters (é and similar are dropped, not transliterated). The result is one string T of 2,506,248 letters. 3. Windows: the **overlapping** set has all 2,506,217 start positions, which gives the point estimate. The **non-overlapping** set has 78,320 windows starting at 0, 32, 64, .... These are treated as roughly independent Bernoulli trials, which gives the 95% interval. I report the exact Clopper-Pearson interval and also the Wilson interval. 4. A window satisfies a pattern when, for every group of 1-based positions, all letters in the group are equal. Different groups may share a letter or not; the homophonic model allows both. - **A (printed order, 29 types):** {1,26}, {2,32}, {6,14}. - **B (route pairs):** {1,6}, {24,25}, {27,31}. - **C (26-type sensitivity):** A plus {5,24}, {11,20}, with 12 added to the 2/32 group ({2,12,32}). This gives 32 − 6 = 26 types. 5. Baseline: if letters were independent with the corpus unigram frequencies p, a group of m positions is equal with probability Σp^m. The baseline for a pattern is the product of these over its groups. 6. Count: fraction × 2^(32h). Here 2^(32h) is the rough number of "typical" 32-letter English texts at entropy rate h. The product is an order-of-magnitude count of English texts whose letter equalities fit the pattern. ### Complete code (Python 3, standard library only; ran in about 20 s) ```python #!/usr/bin/env python3 # Rate at which 32-letter windows of English satisfy Z32 equality patterns. # Usage: python3 -I z32rate.py pg2600.txt import sys, math, re from collections import Counter raw = open(sys.argv[1], encoding="utf-8").read() s = raw.index("*** START OF THE PROJECT GUTENBERG EBOOK") s = raw.index("\n", s) + 1 e = raw.index("*** END OF THE PROJECT GUTENBERG EBOOK") body = raw[s:e] # Keep A-Z only (after upper-casing); every other character, incl. accented letters, is removed. T = re.sub(r"[^A-Z]", "", body.upper()) N = len(T) print("letters", N) W = 32 # 1-based position groups; all positions in a group must carry the same letter. PATTERNS = { "A printed-order doubles {1,26},{2,32},{6,14}": [(1, 26), (2, 32), (6, 14)], "B route pairs {1,6},{24,25},{27,31}": [(1, 6), (24, 25), (27, 31)], "C 26-type sensitivity: A + {5,24},{12,2,32},{11,20}": [(1, 26), (2, 32, 12), (6, 14), (5, 24), (11, 20)], } SINGLE = [(1, 26), (2, 32), (6, 14), (1, 6), (24, 25), (27, 31), (5, 24), (2, 12), (11, 20)] def ok(start, groups): for g in groups: c = T[start + g[0] - 1] for p in g[1:]: if T[start + p - 1] != c: return False return True def logbinpmf(k, n, p): if p <= 0.0: return 0.0 if k == 0 else -math.inf if p >= 1.0: return 0.0 if k == n else -math.inf return (math.lgamma(n + 1) - math.lgamma(k + 1) - math.lgamma(n - k + 1) + k * math.log(p) + (n - k) * math.log1p(-p)) def cdf(k, n, p): # P(X <= k); k is small here so direct summation is fine return sum(math.exp(logbinpmf(i, n, p)) for i in range(0, k + 1)) def clopper_pearson(k, n, a=0.05): def bisect(f, lo, hi): for _ in range(200): mid = (lo + hi) / 2 if f(mid): hi = mid else: lo = mid return (lo + hi) / 2 lo = 0.0 if k == 0 else bisect(lambda p: 1 - cdf(k - 1, n, p) >= a / 2, 0.0, 1.0) hi = 1.0 if k == n else bisect(lambda p: cdf(k, n, p) <= a / 2, 0.0, 1.0) return lo, hi def wilson(k, n, z=1.959963984540054): ph = k / n d = 1 + z * z / n c = (ph + z * z / (2 * n)) / d h = z * math.sqrt(ph * (1 - ph) / n + z * z / (4 * n * n)) / d return max(0.0, c - h), min(1.0, c + h) nover = N - W + 1 nonover = N // W freq = Counter(T) p = {c: freq[c] / N for c in freq} coinc = sum(v * v for v in p.values()) print("letters A-Z distinct", len(freq), "coincidence sum p^2 = %.5f" % coinc) print("overlapping windows", nover, "non-overlapping windows", nonover) H = [1.0, 1.3, 1.5] print("\nsingle pairs (overlapping windows): k/n") for g in SINGLE: k = sum(1 for i in range(nover) if ok(i, [g])) print(g, k, "/", nover, "= %.5f" % (k / nover)) print() for name, groups in PATTERNS.items(): ko = sum(1 for i in range(nover) if ok(i, groups)) kn = sum(1 for j in range(nonover) if ok(j * W, groups)) cp = clopper_pearson(kn, nonover) wl = wilson(kn, nonover) # independence baseline: each group of m positions equal with prob sum p^m base = 1.0 for g in groups: base *= sum(v ** len(g) for v in p.values()) print(name) print(" overlapping k/n = %d/%d = %.3e" % (ko, nover, ko / nover)) print(" non-overlap k/n = %d/%d = %.3e CP95 [%.3e, %.3e] Wilson95 [%.3e, %.3e]" % (kn, nonover, kn / nonover, cp[0], cp[1], wl[0], wl[1])) print(" independent-letter baseline = %.3e" % base) for h in H: m = 2 ** (32 * h) print(" h=%.1f 2^(32h)=%.3e x overlap=%.2e x nonoverlap=%.2e x CP=[%.2e, %.2e]" % (h, m, m * ko / nover, m * kn / nonover, m * cp[0], m * cp[1])) ``` Run: `python3 -I z32rate.py 2600-0.txt` ## 4. Results Unigram coincidence Σp² = 0.06574 (26 letters present). ### Single pairs (overlapping windows, n = 2,506,217) | Pair | k | Fraction | |---|---|---| | 1,26 | 166,824 | 0.06656 | | 2,32 | 167,584 | 0.06687 | | 6,14 | 161,781 | 0.06455 | | 1,6 | 156,396 | 0.06240 | | 24,25 (adjacent) | 86,671 | 0.03458 | | 27,31 | 157,976 | 0.06303 | | 5,24 | 166,977 | 0.06663 | | 2,12 | 166,664 | 0.06650 | | 11,20 | 165,767 | 0.06614 | Adjacent letters are equal (a double letter) only about half as often as letters far apart. Pairs at distances 5 to 25 sit close to Σp². ### Joint patterns | Pattern | Overlapping k/n | Non-overlapping k/n | 95% CI, Clopper-Pearson (non-overlap) | 95% CI, Wilson | Independent-letter baseline | |---|---|---|---|---|---| | A printed order | 685/2,506,217 = 2.733e-4 | 22/78,320 = 2.809e-4 | [1.760e-4, 4.253e-4] | [1.855e-4, 4.253e-4] | 2.841e-4 | | B route pairs | 375/2,506,217 = 1.496e-4 | 12/78,320 = 1.532e-4 | [7.917e-5, 2.676e-4] | [8.765e-5, 2.678e-4] | 2.841e-4 | | C 26-type sensitivity | 0/2,506,217 = 0 | 0/78,320 = 0 | [0, 4.710e-5] | [0, 4.905e-5] | 9.949e-8 | For C, the corpus is too small to see an event at the baseline rate of about 1e-7: about 0.25 matches would be expected among 2.5 million overlapping windows. So the measured value is only an upper bound. The baseline 9.9e-8 is the model-based estimate. ### Order-of-magnitude count of compatible English texts (fraction × 2^(32h)) 2^32 = 4.295e9; 2^41.6 = 3.333e12; 2^48 = 2.815e14. | Pattern | h = 1.0 | h = 1.3 | h = 1.5 | |---|---|---|---| | A, point (overlap) | 1.17e6 | 9.11e8 | 7.69e10 | | A, 95% CI (CP) | [7.56e5, 1.83e6] | [5.87e8, 1.42e9] | [4.96e10, 1.20e11] | | B, point (overlap) | 6.43e5 | 4.99e8 | 4.21e10 | | B, 95% CI (CP) | [3.40e5, 1.15e6] | [2.64e8, 8.92e8] | [2.23e10, 7.53e10] | | C, observed upper bound (CP) | ≤ 2.02e5 | ≤ 1.57e8 | ≤ 1.33e10 | | C, independent-letter baseline × 2^(32h) | ~4.3e2 | ~3.3e5 | ~2.8e7 | Rounded: under the brief's model, English texts compatible with Z32 number about 10^6 (h = 1.0) to 10^11 (h = 1.5) in printed order, and about 10^6 to 10^10 under the route pairs. With the 26-type merges, the count falls to roughly 10^2.6 to 10^7.4 on the baseline, and the measured upper bound is ≤ 10^10. ### Corpus examples (constructed by the script, not solutions) - First non-overlapping window that satisfies A (window 1347): `ITHHISTONGUEASWELLASWITHHISFEETT`. Positions 1=26 are I, 2=32 are T, 6=14 are S. **Constructed example; not a proposed Z32 plaintext.** - First non-overlapping window that satisfies B (window 15811): `ETHEREANDATEVERYWORDHEADDEDBUTDO`. Positions 1=6 are E, 24=25 are D, 27=31 are D. **Constructed example; not a proposed Z32 plaintext.** ## 5. Shows The cipher's repeated-glyph constraints barely filter English. About 1 in 3,600 random 32-letter English windows (2.7e-4, 95% CI 1.8e-4 to 4.3e-4) already fits the printed-order pattern, and that rate matches what independent letters would give. The route pairs fit about 1 in 6,700 (1.5e-4). This is lower only because pair 24,25 asks for a double letter. Multiplying by the number of plausible 32-letter English texts leaves on the order of 10^6 to 10^11 compatible texts, depending on h. Even the 26-type reading leaves about 10^2 to 10^7 on the independence baseline. So under this model the ciphertext alone does not identify a unique plaintext. Any proposed solution needs outside evidence (a key, a stated method, a link to the map or the "radians" hint) beyond merely fitting the ciphertext. ## 6. Does not show It does not show that Z32 is a homophonic substitution read in printed order, or that any route is right. It tests no particular proposed solution, and it does not rule out a system with a shorter key that would fit far fewer texts. The counts are order-of-magnitude figures only. They rest on entropy rates measured on long running text with spaces, not on 32-letter messages a killer might write. They also assume the equality constraints are independent of how likely a text is. The 26-symbol scenario uses one merge chosen by the brief; the FBI worksheet could not be found, and other merges would give different, though probably similar-sized, rates. One corpus (a 19th-century novel in translation) may not represent the cipher's register. ## 7. Assumptions a reader could contest 1. The model: one glyph maps to one letter (homophones allowed), with no nulls, no transposition, and no polyalphabetic key. 2. The transcription and type count: 29 types with exactly three doubles. Glyph identification in handwriting is open to dispute. 3. The route pairs (1&6, 24&25, 27&31) come from a publication I could not locate or verify. 4. The 26-type sensitivity: the FBI "26 different symbols" count and the particular merge (5=24, 12=2=32, 11=20) are taken from the brief, without a fetched source. 5. The corpus: one public-domain translated novel, *War and Peace* (Maude), stands in for "ordinary English". Letter statistics differ by genre and author, and Zodiac letters contain misspellings. 6. The cleaning: spaces and punctuation are dropped, so windows span word boundaries at arbitrary phases. The plaintext might start or end mid-word, or not. 7. Interval method: non-overlapping windows are treated as independent trials, though neighbouring windows are weakly correlated. Overlapping counts give the point estimates but no interval. 8. The h values: 1.0 and 1.3 are cited. 1.5 is not sourced. All of them are for long text on a 27-symbol alphabet, and applying 2^(32h) to a 32-letter string is a typical-set approximation. 9. The counting step: multiplying the fraction by 2^(32h) assumes that pattern-matching is independent of how typical a text is. 10. Constructed examples: they come from the corpus and are illustrations only.