- This is a redacted version of our code where filenames have been removed for anonymity.
- Instructions to run
  - The ASCADv1 dataset can be downloaded at https://github.com/ANSSI-FR/ASCAD/tree/master/ATMEGA_AES_v1
  - The DPAv4 dataset can be downloaded at https://github.com/gabzai/Methodology-for-efficient-CNN-architectures-in-SCA/blob/master/DPA-contest%20v4/DPAv4_dataset.zip
  - The code to run trials is in the `src/scripts` folder. Filenames were hard-coded in the current version of the code. Thus, after downloading + extracting the above datasets, you will need to fill in the directories containing them in the scripts.
    - e.g. for `src/scripts/adversarial_dpav4.py` you will need to extract DPAv4_dataset.zip, then set the ROOT variable to the directory path containing the extracted dataset.'
  - Scripts can be run by typing `python <script_path> --name <name>`. Results will be saved in the directory `outputs/<name>`.
- Relevant files
  - `src/datasets` contains our datasets and data loaders.
    - `src/datasets/synthetic_aes` is our synthetic AES dataset.
    - `src/datasets/ascadv1` is the ASCADv1-fixed key dataset, and `src/datasets/dpav4` is the DPAv4 dataset.
  - `src/models` contains our neural net architectures.
    - `src/models/sca_cnn` is the VGG-like architecture used for 'real' trials.
    - `src/models/multilayer_perceptron.py` is the MLP architecture used for 'synthetic' trials.
  - `src/training_modules` contains code to train neural nets.
    - `src/training_modules/supervised_classification.py` is a Lightning module for doing supervised learning.
    - `src/training_modules/discrete_adversarial_localization.py` is a Lightning module for doing our Adversarial Leakage Localization algorithm.
  - `src/utils` contains various implementations of different things.
    - `src/utils/advantage_correlation` is our implementation of the GMM-PRC metric.
    - `src/utils/template_attack` is our Gaussian Template Attack implementation (i.e. a Gaussian mixture model where predictions from multiple traces in an 'attack' dataset may be accumulated)
    - `src/utils/localization_via_interpretability` contains implementations of the neural net interpretation-based localization baselines.
    - `src/calculate_cpa.py` is our implementation of the Correlation Power Analysis technique.
    - `src/calculate_snr.py` is our implementation of the Signal to Noise Ratio technique.
    - `src/calculate_sosd.py` is our implementation of the Sum of Squared Differences technique.
  - `src/scripts` contains scripts for running trials.
    - `src/scripts/adversarial_ascadv1f.py` is our code for running Adversarial Leakage Localization on ASCADv1.
    - `src/scripts/adversarial_dpav4.py` is our code for running Adversarial Leakage Localization on DPAv4.
    - `src/scripts/adversarial_synthetic_boolean_masking.py` runs ALL on the synthetic dataset w/ Boolean masking.
    - `src/scripts/adversarial_synthetic_no_ops.py` runs ALL on the synthetic dataset w/ random delays.
    - `src/scripts/adversarial_synthetic_shuffling.py` runs ALL on the synthetic dataset w/ random shuffling.
    - `src/scripts/adversarial_synthetic_unprotected.py` runs ALL on the synthetic dataset w/ no countermeasure.
    - `src/compute_baselines.py` computes the baseline leakage localization approaches on DPAv4 and ASCADv1, and computes the GMM-PRC metric for the baselines and our method.
    - `src/supervised_{ascadv1f, dpav4, synthetic_boolean_masking, synthetic_no_ops, synthetic_shuffling, synthetic_unprotected}.py` does a hyperparameter sweep for supervised learning on the respective dataset.