From 78e27a2ede878ccf54e3d0c63f925f621146415b Mon Sep 17 00:00:00 2001 From: TrAyZeN Date: Wed, 31 Jul 2024 11:42:55 +0200 Subject: [PATCH] Move cpa and dpa to distinguishers module --- benches/cpa.rs | 4 ++-- benches/dpa.rs | 2 +- examples/cpa.rs | 2 +- examples/cpa_partioned.rs | 2 +- examples/dpa.rs | 2 +- examples/rank.rs | 2 +- src/{ => distinguishers}/cpa.rs | 0 src/{ => distinguishers}/cpa_normal.rs | 2 +- src/{ => distinguishers}/dpa.rs | 0 src/distinguishers/mod.rs | 3 +++ src/lib.rs | 4 +--- 11 files changed, 12 insertions(+), 11 deletions(-) rename src/{ => distinguishers}/cpa.rs (100%) rename src/{ => distinguishers}/cpa_normal.rs (99%) rename src/{ => distinguishers}/dpa.rs (100%) create mode 100644 src/distinguishers/mod.rs diff --git a/benches/cpa.rs b/benches/cpa.rs index 1aff2cf..a12ee00 100644 --- a/benches/cpa.rs +++ b/benches/cpa.rs @@ -1,6 +1,6 @@ use criterion::{criterion_group, criterion_main, BenchmarkId, Criterion}; -use muscat::cpa::{self, Cpa, CpaProcessor}; -use muscat::cpa_normal; +use muscat::distinguishers::cpa::{self, Cpa, CpaProcessor}; +use muscat::distinguishers::cpa_normal; use muscat::leakage::{hw, sbox}; use ndarray::{Array2, ArrayView1, Axis}; use ndarray_rand::rand::{rngs::StdRng, SeedableRng}; diff --git a/benches/dpa.rs b/benches/dpa.rs index 6fadbd1..747c779 100644 --- a/benches/dpa.rs +++ b/benches/dpa.rs @@ -1,5 +1,5 @@ use criterion::{criterion_group, criterion_main, BenchmarkId, Criterion}; -use muscat::dpa::{dpa, Dpa, DpaProcessor}; +use muscat::distinguishers::dpa::{dpa, Dpa, DpaProcessor}; use muscat::leakage::sbox; use ndarray::{Array1, Array2}; use ndarray_rand::rand::{rngs::StdRng, SeedableRng}; diff --git a/examples/cpa.rs b/examples/cpa.rs index b2357a1..32ecece 100644 --- a/examples/cpa.rs +++ b/examples/cpa.rs @@ -1,6 +1,6 @@ use anyhow::Result; use indicatif::ProgressIterator; -use muscat::cpa_normal::CpaProcessor; +use muscat::distinguishers::cpa_normal::CpaProcessor; use muscat::leakage::{hw, sbox}; use muscat::util::{progress_bar, read_array2_from_npy_file, save_array2}; use ndarray::*; diff --git a/examples/cpa_partioned.rs b/examples/cpa_partioned.rs index 4a2122c..a596838 100644 --- a/examples/cpa_partioned.rs +++ b/examples/cpa_partioned.rs @@ -1,6 +1,6 @@ use anyhow::Result; use indicatif::ProgressIterator; -use muscat::cpa::CpaProcessor; +use muscat::distinguishers::cpa::CpaProcessor; use muscat::leakage::{hw, sbox}; use muscat::util::{progress_bar, read_array2_from_npy_file, save_array}; use rayon::prelude::{ParallelBridge, ParallelIterator}; diff --git a/examples/dpa.rs b/examples/dpa.rs index f450344..0941209 100644 --- a/examples/dpa.rs +++ b/examples/dpa.rs @@ -1,6 +1,6 @@ use anyhow::Result; use indicatif::ProgressIterator; -use muscat::dpa::DpaProcessor; +use muscat::distinguishers::dpa::DpaProcessor; use muscat::leakage::sbox; use muscat::util::read_array2_from_npy_file; use ndarray::{s, Array1}; diff --git a/examples/rank.rs b/examples/rank.rs index a8e9acc..307ab09 100644 --- a/examples/rank.rs +++ b/examples/rank.rs @@ -1,6 +1,6 @@ use anyhow::Result; use indicatif::ProgressIterator; -use muscat::cpa::CpaProcessor; +use muscat::distinguishers::cpa::CpaProcessor; use muscat::leakage::{hw, sbox}; use muscat::util::{progress_bar, read_array2_from_npy_file, save_array}; use ndarray::s; diff --git a/src/cpa.rs b/src/distinguishers/cpa.rs similarity index 100% rename from src/cpa.rs rename to src/distinguishers/cpa.rs diff --git a/src/cpa_normal.rs b/src/distinguishers/cpa_normal.rs similarity index 99% rename from src/cpa_normal.rs rename to src/distinguishers/cpa_normal.rs index 3bee39a..aed0811 100644 --- a/src/cpa_normal.rs +++ b/src/distinguishers/cpa_normal.rs @@ -2,7 +2,7 @@ use ndarray::{Array1, Array2, ArrayView1, ArrayView2, Axis}; use rayon::iter::{ParallelBridge, ParallelIterator}; use std::{iter::zip, ops::Add}; -use crate::cpa::Cpa; +use crate::distinguishers::cpa::Cpa; /// Compute the [`Cpa`] of the given traces using [`CpaProcessor`]. /// diff --git a/src/dpa.rs b/src/distinguishers/dpa.rs similarity index 100% rename from src/dpa.rs rename to src/distinguishers/dpa.rs diff --git a/src/distinguishers/mod.rs b/src/distinguishers/mod.rs new file mode 100644 index 0000000..9cc765b --- /dev/null +++ b/src/distinguishers/mod.rs @@ -0,0 +1,3 @@ +pub mod cpa; +pub mod cpa_normal; +pub mod dpa; diff --git a/src/lib.rs b/src/lib.rs index 120225f..4cd4157 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -1,6 +1,4 @@ -pub mod cpa; -pub mod cpa_normal; -pub mod dpa; +pub mod distinguishers; pub mod leakage; pub mod leakage_detection; pub mod preprocessors;