From 3229a25bfa671306e84fd43873b0ab0ebbdacf3c Mon Sep 17 00:00:00 2001 From: KiHoLee Date: Sat, 22 Aug 2026 14:54:49 +0900 Subject: [PATCH] Per-stage invocation and the permutation-variant measurement --- README.md | 2 ++ code/check_consistency.py | 12 ++++++++++++ code/exp_full.py | 33 +++++++++++++++++++++------------ data/perm_variant.csv | 3 +++ fig/fig_sec_brute.pdf | Bin 34199 -> 34199 bytes fig/fig_sec_jam.pdf | Bin 40133 -> 40133 bytes fig/fig_sec_keylen.pdf | Bin 30392 -> 30392 bytes fig/fig_sec_kpa.pdf | Bin 35148 -> 35148 bytes fig/fig_sec_real.pdf | Bin 37785 -> 37785 bytes fig/fig_sec_sens.pdf | Bin 30347 -> 30347 bytes fig/fig_sec_snr.pdf | Bin 38930 -> 38930 bytes 11 files changed, 38 insertions(+), 12 deletions(-) create mode 100644 data/perm_variant.csv diff --git a/README.md b/README.md index 74c09da..ca7e379 100644 --- a/README.md +++ b/README.md @@ -90,6 +90,8 @@ Logarithms in an entropy or an information rate are base two. | Semantic similarity | `exp_semantic` | `semantic.csv` | | Load and channel-estimate sweeps | `exp_users_csi` | `users.csv`, `csi.csv` | | Permutation-variant check | `exp_full.stage_M` | `perm_variant.csv` | + +Run one stage on its own with `python code/exp_full.py stage_B`, or the whole chain with no argument. | Closed-form and symbolic checks | `verify_math` | `verify_math.csv` | ## Security scope diff --git a/code/check_consistency.py b/code/check_consistency.py index 4f9f77d..384ab21 100644 --- a/code/check_consistency.py +++ b/code/check_consistency.py @@ -216,6 +216,18 @@ chk("degeneracy numbers in tex", and "overlapping by $0.10$ on average over user pairs" in " ".join(tex.split()), "searched tex", needs_tex=True) +# --- why the permutation key is granted a shared permutation --------- +pv = {r["variant"]: float(r["legit_ser"]) for r in rows("perm_variant.csv")} +chk("shared permutation legitimate rate", abs(pv["shared"] - 0.053) < 1e-3, + "%.5f" % pv["shared"]) +chk("per-user permutation legitimate rate", + abs(pv["per_user"] - 0.129) < 1e-3, "%.5f" % pv["per_user"]) +if HAVE_TEX: + chk("quoted permutation cost in tex", + "from $0.053$ to $0.129$" in " ".join(tex.split()), + "searched tex", needs_tex=True) + + # --- key-length sweep floor ------------------------------------------ # The eavesdropper column is an average over eight substitute-key draws, # so the quoted floor must track the data and not one lucky draw. diff --git a/code/exp_full.py b/code/exp_full.py index 0bab7b9..4d5d748 100644 --- a/code/exp_full.py +++ b/code/exp_full.py @@ -18,6 +18,7 @@ Experiment scripts write CSV only, never draw. Fixed seeds. """ from __future__ import annotations import math +import sys import numpy as np import torch @@ -854,19 +855,27 @@ def stage_L_gap(rows): f"over SER {lo:.3f} to {hi:.3f}") -def main(): +CHAIN = ["stage_A", "stage_B", "stage_C", "stage_D", "stage_E", "stage_F", + "stage_I", "stage_J", "stage_L", "stage_M"] + + +def main(names=None): + """Run the named stages, or the whole chain when none are named. + + The README maps every figure and table to its stage, so a reader + reproducing one figure runs that stage alone: + python code/exp_full.py stage_B + """ print(f"device={DEVICE}") - stage_A() - stage_B() - stage_C() - stage_D() - stage_E() - stage_F() - stage_I() - stage_J() - stage_L() - print("[done] full-scale security CSVs in", DATA) + todo = names or CHAIN + unknown = [n for n in todo if n not in CHAIN] + if unknown: + raise SystemExit("unknown stage(s): %s\nknown: %s" + % (", ".join(unknown), ", ".join(CHAIN))) + for n in todo: + globals()[n]() + print("[done] security CSVs in", DATA) if __name__ == "__main__": - main() + main(sys.argv[1:]) diff --git a/data/perm_variant.csv b/data/perm_variant.csv new file mode 100644 index 0000000..571a53c --- /dev/null +++ b/data/perm_variant.csv @@ -0,0 +1,3 @@ +variant,legit_ser +shared,0.05344 +per_user,0.129035 diff --git a/fig/fig_sec_brute.pdf b/fig/fig_sec_brute.pdf index ebb15bcdc3164f6c3a3cb300fcb80eb6d48a4d29..e90c32c60edb41ad2d861f8972b2243cf2a86112 100644 GIT binary patch delta 19 bcmbQ<%{0B6X~U5w7E?o0lg%fZ&NBf3PLv1W delta 19 bcmbQ<%{0B6X~U5w784@_) delta 19 bcmX@Qlj-PArVaOIvX~ed7;Szu^Dz?uU8V^K diff --git a/fig/fig_sec_keylen.pdf b/fig/fig_sec_keylen.pdf index 821702438451187b5e97bd9d7a8044b2944b865e..fa6e8c35cbcf16f99819ec29b2d5e39be90e55e4 100644 GIT binary patch delta 19 acmdn-mT|{h#to6hET)F0Mw?@cqnQC$B?o%| delta 19 acmdn-mT|{h#to6hEG9+ziRsKFrVXiWET)F0rkgX{9y0*|Q7{L$ delta 19 bcmX>ziRsKFrVXiWEG9+&vaf3?aZh@n(+_XC?qokp|%a delta 19 acmeBv%h>&vaf3?