Skip to content

Campaign primitives - #2

Merged
0xdiid merged 4 commits into
mainfrom
campaign-primitives
Jul 11, 2026
Merged

Campaign primitives#2
0xdiid merged 4 commits into
mainfrom
campaign-primitives

Conversation

@0xdiid

@0xdiid 0xdiid commented Jul 11, 2026

Copy link
Copy Markdown
Owner

No description provided.

0xdiid and others added 2 commits July 10, 2026 19:32
…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
0xdiid force-pushed the campaign-primitives branch from 9c55658 to f66644c Compare July 11, 2026 01:33
0xdiid and others added 2 commits July 10, 2026 19:46
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>
@0xdiid
0xdiid merged commit 1a4194a into main Jul 11, 2026
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant