Campaign primitives - #2
Merged
Merged
Conversation
…ty + Caesar-crib diagnostic Tests whether a periodic cipher's cosets are homogeneous (one type) or a mixture, via an IoC-variance homogeneity p-value plus a per-coset best-Caesar LLR that flags cleanly-keyed cosets as exploitable cribs. Uses per-coset multisets only, so it is invariant to any within-coset transposition. Pure-stdlib; complements classify_coset_ioc (which classifies the mean). Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Consolidation of techniques that were hand-rolled across the PK working directory and independently re-derived by multiple community solvers. The general, PK-agnostic core of each is now a first-class, tested module. - scoring.BatchNgramScorer: vectorized 26**n LUT batch scorer that reproduces NgramScorer.score exactly; optional numpy accelerator with pure-Python fallback. get_batch_scorer() caches one over the bundled tables. - nulls (new): structure-preserving null models (within_coset, block_shuffle, permutation, iid_*) + null_test / scan_test with look-elsewhere correction. The honest max-over-search null falls out when the statistic maxes internally. - ciphers/keystream (new): self-generating additive keystream family — keystream/lfsr (linear recurrence) and lcg — with vigenere/beaufort/variant combiners; blind cracks brute the tiny keyspaces via seed-linearization matmul and the batch scorer. Registered in the cipher registry. - construction (new): forward-simulation model-ID — simulate each family, measure a dial vector, refute families that cannot manufacture the observed dials. Complements the discriminant-based cipher_id/diagnose. - power (new): objective power calibration — separation (z/d/AUC), powerless_objective (flat/key-invariant detector), power_curve + dilute_plaintext. - wordlm (new): word_segment (dictionary tiling; long_coverage catches n-gram salad) + word_tiling (reconstruct plaintext from letter multisets; tiling count is a determinacy signal). 46 new tests; ruff + mypy clean; full fast suite green; leak sweep clean. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
0xdiid
force-pushed
the
campaign-primitives
branch
from
July 11, 2026 01:33
9c55658 to
f66644c
Compare
Run the formatter over the branch's changed files. No behavior change: reflows only. Covers the new modules/tests from this branch plus the coset_homogeneity diagnostic's analysis.py/test_analysis.py, which were committed before the formatter was run. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
The within-coset and block-shuffle nulls preserve each coset's letter multiset exactly, so coset-IoC at the period is mathematically invariant. The derived float can still jitter at ~1e-15 (platform-dependent libm summation — seen on the CI Python 3.10.20 leg, exactly 0 locally), which broke bit-exact `== 0.0` / `== null_mean` / `== 1.0` assertions. Assert the invariance with tolerance instead, and check the block-shuffle property at the integer multiset level (sorted coset == sorted coset) rather than through the derived float. Behavior of nulls.py is unchanged. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.