engine.consensus
ConsensusVector - per-byte variance analysis across multiple dumps.
Core of the ‘Elimination via Variance’ approach: bytes that are identical across all runs are structural; bytes with high variance are key candidates.
The output is a 1D variance vector (one float per byte offset), computed via Welford’s online recurrence or a chunked two-pass estimator — the implicit N×d observation matrix is never materialized.
- class ConsensusVector[source]
Bases:
objectPer-byte variance vector across N dumps at the same phase.
- build(dump_paths)[source]
Compute per-byte variance across all dump files.
Applies a chunked two-pass estimator via
core.variance.compute_variance; numerically stable and peak-memory-bounded byCHUNK_BYTESregardless of dump size.
- build_from_sources(sources, normalize=False)[source]
Build consensus from DumpSource objects.
Native MSL sources use ASLR-aware region alignment when normalize is True. Raw, mixed, or imported-MSL sources fall back to flat bytes.
- build_incremental(size)[source]
Begin an incremental consensus build of size bytes per dump.
Use
add_sourceto fold dumps in one at a time andfinalizeto materialize the variance vector and classifications.- Parameters:
size (int)
- Return type:
None
- add_source(source)[source]
Fold one dump into an incremental build. Returns live stats.
Accepts a raw
bytesbuffer or anyDumpSource-like object exposingread_all(). The first dump seen is cached asreference_bytesfor downstream consumers. Returns(num_dumps, mean_variance, max_variance).
- get_live_variance()[source]
Return the current variance vector.
During an incremental build this reflects the Welford state at the moment of the call; after
finalize()it returns the materialized vector. Public accessor so API/UI layers do not reach into the private Welford accumulator.- Return type:
- finalize()[source]
Materialize
varianceandclassificationsfrom the Welford accumulator and release the incremental state.- Return type:
None
- ConsensusMatrix
alias of
ConsensusVector