Key-space attacks against both key families, and the learned SNR sweep
check_family_enum.py now runs both attacks against both families. The outsider ranks the L-1 Walsh rows; the insider, holding m_v, ranks the L-1 products m_v .* m_r, which works because Walsh rows are closed under the elementwise product and the per-block sign cancels in m_u .* m_v. Both need a list to rank, and only the structured family supplies one: the structured family falls at 0.905 from one frame at 10 dB and 0.990 from four, the refresh takes the outsider to 0.000 and leaves the insider at 0.980, and the learned family gives 0.000 throughout. exp_full.stage_N sweeps the learned family over the same SNR grid at the same frame count as stage_A, so Fig. 2 can carry both families and a reader can see what the key space costs at every SNR rather than at one point. check_consistency.py gains four assertions for the key-space measurements and two for the learned sweep, 82 in all. README: the assertion count was two rounds stale, and the figure map omitted family_enum, cov_attack and maskdegen, whose CSVs back quoted manuscript numbers.
This commit is contained in:
+23
-1
@@ -188,6 +188,28 @@ def main_model(iters=4000, P=4, vu=16, d=MAIN_D, U=4):
|
||||
freeze_W=base_keys(U, d // P))
|
||||
|
||||
|
||||
def stage_N():
|
||||
"""Fig. 2's learned-family curves.
|
||||
|
||||
The structured family is enumerable and closed under the elementwise
|
||||
product, the learned one is neither, so the paper reports both. This
|
||||
stage runs the same SNR sweep as stage_A with the keys trained in
|
||||
R^L instead of frozen to Walsh-Hadamard rows, at the same frame
|
||||
count, so the two are directly comparable.
|
||||
"""
|
||||
print("[N] security vs SNR, learned key family ...")
|
||||
m = get_model(P=4, vu=16, d=MAIN_D, U=4, iters=4000, seed=1)
|
||||
snr = [float(v) for v in range(0, 21, 2)]
|
||||
frames = 800_000
|
||||
legit = eval_ser_sse(m, snr, frames=frames)
|
||||
ew = eve_wrong_mask(m.users, m.L, seed=20260813).to(DEVICE)
|
||||
eve_w = eval_ser_eve(m, ew, snr, frames=frames)
|
||||
write_csv(DATA / "sec_snr_learned.csv",
|
||||
["snr_db", "legit", "eve_wrong"],
|
||||
[(s, legit[i], eve_w[i]) for i, s in enumerate(snr)])
|
||||
print(" legit:", [f"{v:.2e}" for v in legit])
|
||||
|
||||
|
||||
def stage_A():
|
||||
print("[A] security vs SNR (V=65536) ...")
|
||||
m = main_model()
|
||||
@@ -856,7 +878,7 @@ def stage_L_gap(rows):
|
||||
|
||||
|
||||
CHAIN = ["stage_A", "stage_B", "stage_C", "stage_D", "stage_E", "stage_F",
|
||||
"stage_I", "stage_J", "stage_L", "stage_M"]
|
||||
"stage_I", "stage_J", "stage_L", "stage_M", "stage_N"]
|
||||
|
||||
|
||||
def main(names=None):
|
||||
|
||||
Reference in New Issue
Block a user