code wiki / (root) / sketch_robust_hll_vs_hll_adv_bench.nx

sketch_robust_hll_vs_hll_adv_bench.nx

buildroot/runtime/sketch_robust_hll_vs_hll_adv_bench.nx

4966 B133 linesdepth 7pulls 13 transitivereach 0 importersview sourcekind benchtopic sketch
docsdependenciesstructsconstsfunctions

about

sketch_robust_hll_vs_hll_adv_bench.nx -- adversarial paired bench. CAPABILITY EXCEED: RobustHll's median-of-k defense rejects register-poisoning attacks that destroy a plain HLL. No DS- family incumbent ships this defense natively (see sketch_robust_hll header comment for survey). This bench DEMONSTRATES the capability gap with sealed measurement. SHARED WORKLOAD: 1. Insert N=1000 legitimate distinct keys into both HLL and RobustHll(k=5). 2. Capture baseline estimates -- both should be ~1000 (within HLL's 15% 3-sigma band). 3. ATTACK: an attacker fills every register of one HLL state. For plain HLL: all 256 registers set to rho=30. For RobustHll: only ONE of the 5 inner sketches gets poisoned (mimics the attacker compromising one seed, not all k). 4. Query both estimates after attack. MEASUREMENT: ACCURACY axis: closer to true N=1000 wins. Expected: plain HLL inflates to ~2e11 (alpha·m·2^30); RobustHll's median stays at ~1000 (4 of 5 inners clean). delta_ppm >> 1e8 expected (orders of magnitude gap).

dependencies 5 imports · 0 importers

syscalls.nx sketch_hll.nx sketch_robust_hll.nx sketch_comparator.nx sketch_types.nx sketch_robust_hll_vs_hll_adv_b

imports: syscalls.nxsketch_hll.nxsketch_robust_hll.nxsketch_comparator.nxsketch_types.nx

imported by: nobody (leaf or entry point)

call flow from main pre-order; caps 40 nodes / depth 6 declared; ↻ = already shown

main nx_hll_alloc nx_robust_hll_alloc nx_hll_alloc ↻ write_key_le nx_hll_add murmur3_32 mm_load_u32_le mm_rotl32 nx_clz32 nx_bits_clz32 nx_robust_hll_add nx_hll_add ↻ nx_hll_estimate nx_hll_pow2_neg_q32 nx_hll_alpha_m_sq_q64 nx_hll_bias_table_n nx_hll_bias_table_get nx_hll_bias_lgk4 nx_hll_bias_lgk5 nx_hll_bias_lgk6 nx_hll_bias_lgk7 nx_hll_bias_lgk8 nx_hll_bias_lgk9 nx_hll_bias_lgk10 nx_hll_log2_ppm nx_hll_bias_correct nx_hll_bias_table_n ↻ nx_hll_bias_table_get ↻ nx_mulshl_div_i64 nx_i128_alloc nx_i128_mul_i64 nx_i128_mul_u64 nx_i128_neg nx_i128_shl nx_i128_div_i64 nx_i128_is_neg nx_i128_neg ↻ nx_i128_udiv_u64 nx_robust_hll_estimate

structs

none

consts

none

functions

32func iabs_a(x: i64) -> i64
called by 1: main
37func write_key_le(buf: *u8, value: i64) -> i64
called by 1: main
48func main() -> i64