PQ-WB-KEM: White-Box ML-KEM-768 1.0
PQ-WB-KEM: Toward a White-Box Construction of ML-KEM-768 with Arithmetic Masking for M2M Communications - Mathematics (MDPI)
Loading...
Searching...
No Matches
table_extraction_witness.py File Reference

Entry-determinacy witness: recover the whole Construction-B baked table set from its minimum determining entries, and measure Construction A's zero-read secret exposure, using this repository's own table builder. More...

Go to the source code of this file.

Classes

class  table_extraction_witness._CountingArray
 Array proxy that charges every indexed entry to a read budget. More...
 
class  table_extraction_witness.ReadCountingTables
 Baked-table view that counts every entry fetched by the extractor. More...
 

Namespaces

namespace  table_extraction_witness
 

Functions

 table_extraction_witness._bit_exact (a, b)
 Bit-exact comparison of two baked table sets.
 
 table_extraction_witness._build_encoding_sublayer (seed)
 Output-encoding sublayer: per factor two random Z_q bijections plus their two derived inverses.
 
 table_extraction_witness._invertibility_sweep (tabs, sh)
 Check that every nonzero index recovers the baked scalar: s0 = h0[x]*x^-1.
 
 table_extraction_witness._measure_determinacy_degree_baked (seed_a, seed_b)
 Measure Construction B's entry-determinacy degree d instead of asserting it.
 
 table_extraction_witness._secret_polys (seed)
 ML-KEM-768 secret: K polys, coefficients uniform over {-2..2} (the CBD support; the extraction budget is distribution-independent), in the NTT domain.
 
 table_extraction_witness._stored_bytes (tabs)
 Serialized footprint of one polynomial's baked table set.
 
 table_extraction_witness.extract_and_regenerate (view, gammas)
 Read the determining entries of each baked table and rebuild the full set.
 
 table_extraction_witness.main ()
 Run the entry-determinacy witness on both constructions and write JSON.
 

Variables

int table_extraction_witness.ENC_INDEPENDENT_PER_FACTOR = 2
 
int table_extraction_witness.ENC_TABLES_PER_FACTOR = 4
 
 table_extraction_witness.m
 
 table_extraction_witness.reads
 
int table_extraction_witness.SEED = 42
 
tuple table_extraction_witness.SEEDS = (42, 1337, 20250714, 7, 99)
 
int table_extraction_witness.Z_TRIALS = 1000
 

Detailed Description

Entry-determinacy witness: recover the whole Construction-B baked table set from its minimum determining entries, and measure Construction A's zero-read secret exposure, using this repository's own table builder.

The entry-determinacy degree d of a table family is the minimum number of entries that determine the whole table. Construction B bakes h(x) = shat*x mod q, which is Z_q-linear, so d = 1: the entry at the unit index is the scalar itself and every other entry is a public multiple of it. The budget at which a table-access- bounded adversary attains advantage 1 is therefore M* = (independent secret scalars) x (bytes per entry), independent of the stored size S_tbl. This script witnesses that claim end to end: it reads the determining entries out of tables built by build_baked_tables(), regenerates the full set, checks bit-exactness over all 384 (component, polynomial) pairs and several seeds, and measures the success rate Z of the regenerated tables against base_mul_direct on fresh ciphertexts. Construction A is measured on the other side of the dichotomy: build_shared_table() takes no secret argument (d = 0, a public function), so the secret is never in the table and the extractor needs zero table reads – it is the plain sh argument of base_mul_shared.

Note
The separator is not key-determinism (a PRF-derived table family is also a deterministic function of its key) but efficient local invertibility: B's scalar-to-table map is linear and inverts from one entry.
Every numeric field is derived from objects built in this run: footprints come from ndarray .nbytes / .itemsize, read volume from the entries actually fetched, and Z from executed trials. Prior expectations appear only as booleans under expected_targets, never as emitted quantities.

Output Files

Usage

Author
Ugur Coruh

Definition in file table_extraction_witness.py.