KiHoLee 17d23fa76a Ciphertext-only family enumeration, and checks that reproduce off a GPU
check_family_enum.py measures the attack the manuscript now states in
Section III-A: the winning correlation is an index-free verifier, so
ranking the 63 non-constant Walsh rows by mean winning correlation
recovers the user set from one frame in 0.905 of 200 trials at 10 dB
and from four frames in 0.990, using nothing outside the stated threat
model. Under the invariance refresh it recovers it in none, because the
entry permutation relabels the codebook the adversary must align
against.

V8 and V9 read the trained codebook through main_model(), which
retrains on every call, and a codebook trained on CUDA is not the one
trained on CPU. The shipped verify_math.csv therefore read PASS here
and FAIL for anyone running this package without a GPU. model_main.pt
is 7 KB and fixes the codebook, which is what both checks are about;
delete it to retrain. V1-V11 now pass on both.

New checks: V10, the format-matched OMA reference Section VI-B quotes,
and V11, the closed-form against Monte Carlo comparison the manuscript
claimed and never stored. V3a's bias-linearity result was computed and
printed but never written to the CSV, so the one linearity claim the
paper quotes was the one this package could not show.

check_consistency.py gains 21 assertions, covering five data files that
no assertion read (users, csi, semantic, cov_attack, sec_jam) and the
trend claims it structurally could not see, since it compared values
and not shapes.

README: the figure map named stages that do not write the artifacts
they list, so following it did not reproduce Figs. 4 and 6; the
reproduction block was five scripts short; and the refresh numbers were
from a superseded run (nearly three, 15.0 to 64.8 bits) against the
manuscript's 2.3 and 23.8 to 364.6.
2026-08-28 17:40:28 +09:00

Keyed Masking for Secure Multi-User Semantic Communication

Reproducibility package for the manuscript Mask-as-Key Secure Multiple Access for Semantic Communications: Physical-Layer Encryption and Jamming Robustness, submitted to the IEEE Transactions on Information Forensics and Security.

Every figure and table in the paper is regenerated from this repository. Experiment scripts write CSV files to data/ and never draw; replot_security.py reads only data/ and writes the figure PDFs to fig/; make_tables.py prints the LaTeX rows of the result tables.

Idea

Multi-user semantic communication superposes several users on one frame and multiplies each user embedding by a distinct pattern so that the receivers can separate them. This code treats that pattern as a secret key. One keyed operation then encrypts each user against a receiver without the key, separates the users, and spreads a jammer that does not hold the key, at no extra bandwidth, power, or rate.

Layout

code/
  sse_lib.py            transmit and receive core, channel, training, OMA reference
  exp_full.py           stages A-F and L: SNR sweep, key length, jamming across
                        schemes, key families, scheme comparison, attack difficulty
  exp_kpa.py            stage H: known-plaintext attack on the key
  exp_refresh.py        stage K: the key-refresh layer, invariance group
  exp_permkpa.py        permutation-key known-plaintext attack (Fig. 7)
  check_cov_*.py        ciphertext-only covariance-attack checks (referee M1)
  exp_real_sec.py       stage G: real BERT WordPiece token streams
  verify_math.py        closed-form checks V1-V11, PASS/FAIL and verify_math.csv
  replot_security.py    every result figure, from data/ to fig/
  make_tables.py        LaTeX rows of every result table, from data/
  feasibility_security.py   early CPU-sized study, kept for the record
data/                   CSV results, one file per stage
fig/                    figure PDFs, regenerated by replot_security.py

Reproducing

Requires Python 3, PyTorch, NumPy, and Matplotlib. The real-token stage additionally needs datasets and transformers. A CUDA device is recommended; the code falls back to CPU. Under Windows install PyTorch in WSL, because the native Windows build does not load the CUDA libraries.

python verify_math.py        # closed-form verification, prints PASS/FAIL
python exp_full.py           # stages A-F and L
python exp_kpa.py            # known-plaintext attack
python exp_refresh.py        # the key-refresh layer
python exp_real_sec.py       # real token streams
python exp_permkpa.py        # permutation-key known plaintext
python exp_infotheory.py     # mutual information and equivocation
python exp_semantic.py       # semantic-similarity leakage
python exp_users_csi.py      # load and channel-estimate sweeps
python check_cov_attack.py   # ciphertext-only covariance attack
python check_family_enum.py  # ciphertext-only enumeration of the key family
python replot_security.py    # all figures from the CSVs
python make_tables.py        # LaTeX rows of the result tables

Seeds are fixed: training 1, evaluation 777, attacker key guess 20260813, key recovery 4242, brute-force search 31, cross-scheme comparison 11, key refresh 5150. Re-running reproduces the released CSV files.

Conventions

Flat Rayleigh fading, one gain per user per frame, with unit mean power. A frame carries unit energy, so the SNR in decibels is the frame energy over the total noise across all d real dimensions, and every scheme in a comparison spends the same energy, bandwidth and rate. The jamming-to-signal ratio is the jammer energy over the same frame energy. Logarithms in an entropy or an information rate are base two.

Figure and table map

Artifact Script Data
Fig. 2 SER against SNR exp_full.stage_A sec_snr.csv
Fig. 3 key length exp_full.stage_B sec_keylen.csv
Fig. 4 jamming (4 schemes) exp_full.stage_C, stage_L sec_jam_cmp.csv, sec_jam.csv
Fig. 5 key sensitivity exp_full.stage_I sec_sens_cmp.csv
Fig. 6 brute-force search exp_full.stage_I, stage_F, stage_J sec_brute_cmp.csv, sec_brute.csv
Fig. 7 known-plaintext attack exp_kpa, exp_permkpa kpa.csv, pkpa.csv
Fig. 8 real token streams exp_real_sec real_sec_ter.csv
Scheme comparison table exp_full.stage_E sec_compare.csv
Key family table exp_full.stage_D sec_maskfam.csv, sec_regjam.csv
Headline recovery table exp_real_sec real_sec_stats.json
Key refresh tables exp_refresh refresh_summary.csv, refresh_kpa.csv
Information-theoretic leakage exp_infotheory infotheory.csv
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

The analysis covers an adversary that observes transmitted frames. The masking is linear, so an adversary that also learns the indices some frames carried recovers the key from a few frames, which exp_kpa.py measures. The key must therefore be refreshed per coherence block from a shared seed. exp_refresh.py implements that layer and shows why it has to draw from the transformations that leave the decision statistic invariant: a refresh that installs fresh orthogonal keys instead costs the legitimate users a factor of 2.3, while the invariant refresh costs nothing and raises the per-block key from 23.8 to 364.6 bits.

License

MIT for the code. The AG News data and the language-model tokenizer are obtained from their own sources under their own terms.

S
Description
Synced with github.com/KiHoLee/TOIFAS
Readme MIT
2.2 MiB
Languages
Python 100%