mlsca-bench 0.1.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- mlsca_bench-0.1.0/LICENSE +201 -0
- mlsca_bench-0.1.0/PKG-INFO +271 -0
- mlsca_bench-0.1.0/README.md +204 -0
- mlsca_bench-0.1.0/pyproject.toml +92 -0
- mlsca_bench-0.1.0/setup.cfg +4 -0
- mlsca_bench-0.1.0/src/mlsca_bench/__init__.py +73 -0
- mlsca_bench-0.1.0/src/mlsca_bench/__main__.py +9 -0
- mlsca_bench-0.1.0/src/mlsca_bench/benchmark/__init__.py +68 -0
- mlsca_bench-0.1.0/src/mlsca_bench/benchmark/classical.py +350 -0
- mlsca_bench-0.1.0/src/mlsca_bench/benchmark/leakage.py +319 -0
- mlsca_bench-0.1.0/src/mlsca_bench/benchmark/metrics.py +129 -0
- mlsca_bench-0.1.0/src/mlsca_bench/benchmark/plots.py +99 -0
- mlsca_bench-0.1.0/src/mlsca_bench/benchmark/splits.json +9 -0
- mlsca_bench-0.1.0/src/mlsca_bench/benchmark/splits.py +374 -0
- mlsca_bench-0.1.0/src/mlsca_bench/cli.py +332 -0
- mlsca_bench-0.1.0/src/mlsca_bench/datasets/__init__.py +70 -0
- mlsca_bench-0.1.0/src/mlsca_bench/datasets/adapters/__init__.py +43 -0
- mlsca_bench-0.1.0/src/mlsca_bench/datasets/adapters/_concat.py +229 -0
- mlsca_bench-0.1.0/src/mlsca_bench/datasets/adapters/_hdf5.py +56 -0
- mlsca_bench-0.1.0/src/mlsca_bench/datasets/adapters/aes_hd_csv.py +275 -0
- mlsca_bench-0.1.0/src/mlsca_bench/datasets/adapters/agilent.py +231 -0
- mlsca_bench-0.1.0/src/mlsca_bench/datasets/adapters/ascad.py +52 -0
- mlsca_bench-0.1.0/src/mlsca_bench/datasets/adapters/asciiwave.py +247 -0
- mlsca_bench-0.1.0/src/mlsca_bench/datasets/adapters/ascon.py +57 -0
- mlsca_bench-0.1.0/src/mlsca_bench/datasets/adapters/chameleon.py +380 -0
- mlsca_bench-0.1.0/src/mlsca_bench/datasets/adapters/hdf5.py +527 -0
- mlsca_bench-0.1.0/src/mlsca_bench/datasets/adapters/lecroy.py +299 -0
- mlsca_bench-0.1.0/src/mlsca_bench/datasets/adapters/manifest.py +250 -0
- mlsca_bench-0.1.0/src/mlsca_bench/datasets/adapters/matlab.py +236 -0
- mlsca_bench-0.1.0/src/mlsca_bench/datasets/adapters/npy.py +400 -0
- mlsca_bench-0.1.0/src/mlsca_bench/datasets/adapters/pickled.py +131 -0
- mlsca_bench-0.1.0/src/mlsca_bench/datasets/adapters/rawbinary.py +188 -0
- mlsca_bench-0.1.0/src/mlsca_bench/datasets/adapters/scaaml.py +391 -0
- mlsca_bench-0.1.0/src/mlsca_bench/datasets/adapters/trs.py +233 -0
- mlsca_bench-0.1.0/src/mlsca_bench/datasets/adapters/two_class.py +110 -0
- mlsca_bench-0.1.0/src/mlsca_bench/datasets/base.py +390 -0
- mlsca_bench-0.1.0/src/mlsca_bench/datasets/cache.py +90 -0
- mlsca_bench-0.1.0/src/mlsca_bench/datasets/download.py +1463 -0
- mlsca_bench-0.1.0/src/mlsca_bench/datasets/errors.py +118 -0
- mlsca_bench-0.1.0/src/mlsca_bench/datasets/loading.py +731 -0
- mlsca_bench-0.1.0/src/mlsca_bench/datasets/registry.json +4056 -0
- mlsca_bench-0.1.0/src/mlsca_bench/datasets/registry.py +1204 -0
- mlsca_bench-0.1.0/src/mlsca_bench/models/__init__.py +45 -0
- mlsca_bench-0.1.0/src/mlsca_bench/models/attack.py +312 -0
- mlsca_bench-0.1.0/src/mlsca_bench/models/cnn.py +126 -0
- mlsca_bench-0.1.0/src/mlsca_bench/models/registry.py +182 -0
- mlsca_bench-0.1.0/src/mlsca_bench/py.typed +0 -0
- mlsca_bench-0.1.0/src/mlsca_bench.egg-info/PKG-INFO +271 -0
- mlsca_bench-0.1.0/src/mlsca_bench.egg-info/SOURCES.txt +92 -0
- mlsca_bench-0.1.0/src/mlsca_bench.egg-info/dependency_links.txt +1 -0
- mlsca_bench-0.1.0/src/mlsca_bench.egg-info/entry_points.txt +2 -0
- mlsca_bench-0.1.0/src/mlsca_bench.egg-info/requires.txt +59 -0
- mlsca_bench-0.1.0/src/mlsca_bench.egg-info/top_level.txt +1 -0
- mlsca_bench-0.1.0/tests/test_adapter_config.py +80 -0
- mlsca_bench-0.1.0/tests/test_aes_hd_csv.py +94 -0
- mlsca_bench-0.1.0/tests/test_aesptv2.py +79 -0
- mlsca_bench-0.1.0/tests/test_agilent.py +96 -0
- mlsca_bench-0.1.0/tests/test_ascad.py +280 -0
- mlsca_bench-0.1.0/tests/test_asciiwave.py +108 -0
- mlsca_bench-0.1.0/tests/test_ascon.py +113 -0
- mlsca_bench-0.1.0/tests/test_base.py +122 -0
- mlsca_bench-0.1.0/tests/test_chunked.py +341 -0
- mlsca_bench-0.1.0/tests/test_classical.py +84 -0
- mlsca_bench-0.1.0/tests/test_custom_datasets.py +274 -0
- mlsca_bench-0.1.0/tests/test_custom_model.py +67 -0
- mlsca_bench-0.1.0/tests/test_dataset_fixes.py +82 -0
- mlsca_bench-0.1.0/tests/test_download.py +301 -0
- mlsca_bench-0.1.0/tests/test_download_checks.py +178 -0
- mlsca_bench-0.1.0/tests/test_download_housekeeping.py +55 -0
- mlsca_bench-0.1.0/tests/test_hdf5_generic.py +286 -0
- mlsca_bench-0.1.0/tests/test_input_checks.py +30 -0
- mlsca_bench-0.1.0/tests/test_large_downloads.py +64 -0
- mlsca_bench-0.1.0/tests/test_leakage_advanced.py +155 -0
- mlsca_bench-0.1.0/tests/test_leakage_metrics.py +180 -0
- mlsca_bench-0.1.0/tests/test_lecroy.py +68 -0
- mlsca_bench-0.1.0/tests/test_manifest.py +135 -0
- mlsca_bench-0.1.0/tests/test_matlab.py +169 -0
- mlsca_bench-0.1.0/tests/test_missing_extras.py +46 -0
- mlsca_bench-0.1.0/tests/test_models.py +170 -0
- mlsca_bench-0.1.0/tests/test_npy.py +75 -0
- mlsca_bench-0.1.0/tests/test_npz.py +73 -0
- mlsca_bench-0.1.0/tests/test_pickle.py +95 -0
- mlsca_bench-0.1.0/tests/test_rar.py +69 -0
- mlsca_bench-0.1.0/tests/test_rawbinary.py +108 -0
- mlsca_bench-0.1.0/tests/test_registry.py +462 -0
- mlsca_bench-0.1.0/tests/test_reproducibility.py +82 -0
- mlsca_bench-0.1.0/tests/test_saved_datasets_and_cli.py +209 -0
- mlsca_bench-0.1.0/tests/test_scaaml.py +146 -0
- mlsca_bench-0.1.0/tests/test_split_archives.py +239 -0
- mlsca_bench-0.1.0/tests/test_splits.py +203 -0
- mlsca_bench-0.1.0/tests/test_spook_split.py +120 -0
- mlsca_bench-0.1.0/tests/test_trs.py +166 -0
- mlsca_bench-0.1.0/tests/test_two_class.py +86 -0
- mlsca_bench-0.1.0/tests/test_windows.py +89 -0
|
@@ -0,0 +1,201 @@
|
|
|
1
|
+
Apache License
|
|
2
|
+
Version 2.0, January 2004
|
|
3
|
+
http://www.apache.org/licenses/
|
|
4
|
+
|
|
5
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
6
|
+
|
|
7
|
+
1. Definitions.
|
|
8
|
+
|
|
9
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
10
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
11
|
+
|
|
12
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
13
|
+
the copyright owner that is granting the License.
|
|
14
|
+
|
|
15
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
16
|
+
other entities that control, are controlled by, or are under common
|
|
17
|
+
control with that entity. For the purposes of this definition,
|
|
18
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
19
|
+
direction or management of such entity, whether by contract or
|
|
20
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
21
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
22
|
+
|
|
23
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
24
|
+
exercising permissions granted by this License.
|
|
25
|
+
|
|
26
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
27
|
+
including but not limited to software source code, documentation
|
|
28
|
+
source, and configuration files.
|
|
29
|
+
|
|
30
|
+
"Object" form shall mean any form resulting from mechanical
|
|
31
|
+
transformation or translation of a Source form, including but
|
|
32
|
+
not limited to compiled object code, generated documentation,
|
|
33
|
+
and conversions to other media types.
|
|
34
|
+
|
|
35
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
36
|
+
Object form, made available under the License, as indicated by a
|
|
37
|
+
copyright notice that is included in or attached to the work
|
|
38
|
+
(an example is provided in the Appendix below).
|
|
39
|
+
|
|
40
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
41
|
+
form, that is based on (or derived from) the Work and for which the
|
|
42
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
43
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
44
|
+
of this License, Derivative Works shall not include works that remain
|
|
45
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
46
|
+
the Work and Derivative Works thereof.
|
|
47
|
+
|
|
48
|
+
"Contribution" shall mean any work of authorship, including
|
|
49
|
+
the original version of the Work and any modifications or additions
|
|
50
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
51
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
52
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
53
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
54
|
+
means any form of electronic, verbal, or written communication sent
|
|
55
|
+
to the Licensor or its representatives, including but not limited to
|
|
56
|
+
communication on electronic mailing lists, source code control systems,
|
|
57
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
58
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
59
|
+
excluding communication that is conspicuously marked or otherwise
|
|
60
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
61
|
+
|
|
62
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
63
|
+
on behalf of whom a Contribution has been received by Licensor and
|
|
64
|
+
subsequently incorporated within the Work.
|
|
65
|
+
|
|
66
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
67
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
68
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
69
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
70
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
71
|
+
Work and such Derivative Works in Source or Object form.
|
|
72
|
+
|
|
73
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
74
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
75
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
76
|
+
(except as stated in this section) patent license to make, have made,
|
|
77
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
78
|
+
where such license applies only to those patent claims licensable
|
|
79
|
+
by such Contributor that are necessarily infringed by their
|
|
80
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
81
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
82
|
+
institute patent litigation against any entity (including a
|
|
83
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
84
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
85
|
+
or contributory patent infringement, then any patent licenses
|
|
86
|
+
granted to You under this License for that Work shall terminate
|
|
87
|
+
as of the date such litigation is filed.
|
|
88
|
+
|
|
89
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
90
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
91
|
+
modifications, and in Source or Object form, provided that You
|
|
92
|
+
meet the following conditions:
|
|
93
|
+
|
|
94
|
+
(a) You must give any other recipients of the Work or
|
|
95
|
+
Derivative Works a copy of this License; and
|
|
96
|
+
|
|
97
|
+
(b) You must cause any modified files to carry prominent notices
|
|
98
|
+
stating that You changed the files; and
|
|
99
|
+
|
|
100
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
101
|
+
that You distribute, all copyright, patent, trademark, and
|
|
102
|
+
attribution notices from the Source form of the Work,
|
|
103
|
+
excluding those notices that do not pertain to any part of
|
|
104
|
+
the Derivative Works; and
|
|
105
|
+
|
|
106
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
107
|
+
distribution, then any Derivative Works that You distribute must
|
|
108
|
+
include a readable copy of the attribution notices contained
|
|
109
|
+
within such NOTICE file, excluding those notices that do not
|
|
110
|
+
pertain to any part of the Derivative Works, in at least one
|
|
111
|
+
of the following places: within a NOTICE text file distributed
|
|
112
|
+
as part of the Derivative Works; within the Source form or
|
|
113
|
+
documentation, if provided along with the Derivative Works; or,
|
|
114
|
+
within a display generated by the Derivative Works, if and
|
|
115
|
+
wherever such third-party notices normally appear. The contents
|
|
116
|
+
of the NOTICE file are for informational purposes only and
|
|
117
|
+
do not modify the License. You may add Your own attribution
|
|
118
|
+
notices within Derivative Works that You distribute, alongside
|
|
119
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
120
|
+
that such additional attribution notices cannot be construed
|
|
121
|
+
as modifying the License.
|
|
122
|
+
|
|
123
|
+
You may add Your own copyright statement to Your modifications and
|
|
124
|
+
may provide additional or different license terms and conditions
|
|
125
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
126
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
127
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
128
|
+
the conditions stated in this License.
|
|
129
|
+
|
|
130
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
131
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
132
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
133
|
+
this License, without any additional terms or conditions.
|
|
134
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
135
|
+
the terms of any separate license agreement you may have executed
|
|
136
|
+
with Licensor regarding such Contributions.
|
|
137
|
+
|
|
138
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
139
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
140
|
+
except as required for reasonable and customary use in describing the
|
|
141
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
142
|
+
|
|
143
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
144
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
145
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
146
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
147
|
+
implied, including, without limitation, any warranties or conditions
|
|
148
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
149
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
150
|
+
appropriateness of using or redistributing the Work and assume any
|
|
151
|
+
risks associated with Your exercise of permissions under this License.
|
|
152
|
+
|
|
153
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
154
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
155
|
+
unless required by applicable law (such as deliberate and grossly
|
|
156
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
157
|
+
liable to You for damages, including any direct, indirect, special,
|
|
158
|
+
incidental, or consequential damages of any character arising as a
|
|
159
|
+
result of this License or out of the use or inability to use the
|
|
160
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
161
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
162
|
+
other commercial damages or losses), even if such Contributor
|
|
163
|
+
has been advised of the possibility of such damages.
|
|
164
|
+
|
|
165
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
166
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
167
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
168
|
+
or other liability obligations and/or rights consistent with this
|
|
169
|
+
License. However, in accepting such obligations, You may act only
|
|
170
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
171
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
172
|
+
defend, and hold each Contributor harmless for any liability
|
|
173
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
174
|
+
of your accepting any such warranty or additional liability.
|
|
175
|
+
|
|
176
|
+
END OF TERMS AND CONDITIONS
|
|
177
|
+
|
|
178
|
+
APPENDIX: How to apply the Apache License to your work.
|
|
179
|
+
|
|
180
|
+
To apply the Apache License to your work, attach the following
|
|
181
|
+
boilerplate notice, with the fields enclosed by brackets "[]"
|
|
182
|
+
replaced with your own identifying information. (Don't include
|
|
183
|
+
the brackets!) The text should be enclosed in the appropriate
|
|
184
|
+
comment syntax for the file format. We also recommend that a
|
|
185
|
+
file or class name and description of purpose be included on the
|
|
186
|
+
same "printed page" as the copyright notice for easier
|
|
187
|
+
identification within third-party archives.
|
|
188
|
+
|
|
189
|
+
Copyright [yyyy] [name of copyright owner]
|
|
190
|
+
|
|
191
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
192
|
+
you may not use this file except in compliance with the License.
|
|
193
|
+
You may obtain a copy of the License at
|
|
194
|
+
|
|
195
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
196
|
+
|
|
197
|
+
Unless required by applicable law or agreed to in writing, software
|
|
198
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
199
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
200
|
+
See the License for the specific language governing permissions and
|
|
201
|
+
limitations under the License.
|
|
@@ -0,0 +1,271 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: mlsca-bench
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: Public side-channel datasets, baselines and metrics for machine-learning side-channel analysis
|
|
5
|
+
Author-email: Iris Dania Jimenez <iris.jimenez@unibw.de>, Michael Hutter <michael.hutter@unibw.de>
|
|
6
|
+
License-Expression: Apache-2.0
|
|
7
|
+
Project-URL: Homepage, https://github.com/essec-lab/mlsca-bench
|
|
8
|
+
Project-URL: Repository, https://github.com/essec-lab/mlsca-bench
|
|
9
|
+
Project-URL: Issues, https://github.com/essec-lab/mlsca-bench/issues
|
|
10
|
+
Keywords: side-channel analysis,sca,deep learning,power analysis,cryptography,datasets,benchmark
|
|
11
|
+
Classifier: Development Status :: 3 - Alpha
|
|
12
|
+
Classifier: Intended Audience :: Science/Research
|
|
13
|
+
Classifier: Programming Language :: Python :: 3
|
|
14
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
15
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
16
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
17
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
18
|
+
Classifier: Programming Language :: Python :: 3.14
|
|
19
|
+
Classifier: Topic :: Scientific/Engineering
|
|
20
|
+
Classifier: Topic :: Security :: Cryptography
|
|
21
|
+
Classifier: Typing :: Typed
|
|
22
|
+
Requires-Python: >=3.10
|
|
23
|
+
Description-Content-Type: text/markdown
|
|
24
|
+
License-File: LICENSE
|
|
25
|
+
Requires-Dist: numpy>=1.26
|
|
26
|
+
Requires-Dist: pooch<2,>=1.9
|
|
27
|
+
Requires-Dist: requests<3,>=2.25
|
|
28
|
+
Requires-Dist: tqdm<5,>=4.66
|
|
29
|
+
Provides-Extra: hdf5
|
|
30
|
+
Requires-Dist: h5py>=3.10; extra == "hdf5"
|
|
31
|
+
Provides-Extra: matlab
|
|
32
|
+
Requires-Dist: scipy>=1.10; extra == "matlab"
|
|
33
|
+
Provides-Extra: pickle
|
|
34
|
+
Requires-Dist: pandas<4,>=2; extra == "pickle"
|
|
35
|
+
Provides-Extra: eval
|
|
36
|
+
Requires-Dist: torch<3,>=2; extra == "eval"
|
|
37
|
+
Provides-Extra: plot
|
|
38
|
+
Requires-Dist: matplotlib>=3.7; extra == "plot"
|
|
39
|
+
Provides-Extra: gdrive
|
|
40
|
+
Requires-Dist: gdown>=5.2; extra == "gdrive"
|
|
41
|
+
Provides-Extra: gcs
|
|
42
|
+
Requires-Dist: google-cloud-storage<4,>=2; extra == "gcs"
|
|
43
|
+
Provides-Extra: huggingface
|
|
44
|
+
Requires-Dist: huggingface-hub<2,>=0.25; extra == "huggingface"
|
|
45
|
+
Provides-Extra: sevenzip
|
|
46
|
+
Requires-Dist: py7zr>=0.22; extra == "sevenzip"
|
|
47
|
+
Provides-Extra: zstd
|
|
48
|
+
Requires-Dist: zstandard>=0.22; python_version < "3.14" and extra == "zstd"
|
|
49
|
+
Provides-Extra: all
|
|
50
|
+
Requires-Dist: gdown>=5.2; extra == "all"
|
|
51
|
+
Requires-Dist: google-cloud-storage<4,>=2; extra == "all"
|
|
52
|
+
Requires-Dist: h5py>=3.10; extra == "all"
|
|
53
|
+
Requires-Dist: huggingface-hub<2,>=0.25; extra == "all"
|
|
54
|
+
Requires-Dist: matplotlib>=3.7; extra == "all"
|
|
55
|
+
Requires-Dist: pandas<4,>=2; extra == "all"
|
|
56
|
+
Requires-Dist: py7zr>=0.22; extra == "all"
|
|
57
|
+
Requires-Dist: scipy>=1.10; extra == "all"
|
|
58
|
+
Requires-Dist: zstandard>=0.22; python_version < "3.14" and extra == "all"
|
|
59
|
+
Provides-Extra: test
|
|
60
|
+
Requires-Dist: h5py>=3.10; extra == "test"
|
|
61
|
+
Requires-Dist: matplotlib>=3.7; extra == "test"
|
|
62
|
+
Requires-Dist: pandas<4,>=2; extra == "test"
|
|
63
|
+
Requires-Dist: pytest<10,>=8; extra == "test"
|
|
64
|
+
Requires-Dist: scipy>=1.10; extra == "test"
|
|
65
|
+
Requires-Dist: zstandard>=0.22; python_version < "3.14" and extra == "test"
|
|
66
|
+
Dynamic: license-file
|
|
67
|
+
|
|
68
|
+
# MLSCA-Bench
|
|
69
|
+
|
|
70
|
+
A toolkit for machine-learning side-channel analysis (ML-SCA): **64 public datasets** behind one interface, baseline attacks, and one definition of guessing entropy and success rate, so that results are comparable.
|
|
71
|
+
|
|
72
|
+
With MLSCA-Bench you can:
|
|
73
|
+
|
|
74
|
+
1. **download and load** any of the 64 datasets with one line, whatever their original format;
|
|
75
|
+
2. **run the baselines**: 4 deep-learning models (MLP, ASCAD MLP, ASCAD CNN and Zaid CNN) and 3 classical attacks (CPA, DPA, templates);
|
|
76
|
+
3. **compute guessing entropy and success rate** and plot them;
|
|
77
|
+
4. **add your own dataset** and use it like a built-in one;
|
|
78
|
+
5. **add your own model** and run it like a baseline.
|
|
79
|
+
|
|
80
|
+
It works on Linux, macOS and Windows with Python 3.10 or newer.
|
|
81
|
+
|
|
82
|
+
- [Installation](#installation)
|
|
83
|
+
- [1. Download and load a dataset](#1-download-and-load-a-dataset)
|
|
84
|
+
- [2. Run a baseline](#2-run-a-baseline)
|
|
85
|
+
- [3. Guessing entropy, success rate and plots](#3-guessing-entropy-success-rate-and-plots)
|
|
86
|
+
- [4. Add your own dataset](#4-add-your-own-dataset)
|
|
87
|
+
- [5. Add your own model](#5-add-your-own-model)
|
|
88
|
+
- [The datasets](#the-datasets)
|
|
89
|
+
- [Contributing](#contributing)
|
|
90
|
+
- [Contact](#contact)
|
|
91
|
+
- [License / copyright](#license--copyright)
|
|
92
|
+
|
|
93
|
+
## Installation
|
|
94
|
+
|
|
95
|
+
```bash
|
|
96
|
+
pip install "mlsca-bench[hdf5,eval,plot]"
|
|
97
|
+
```
|
|
98
|
+
|
|
99
|
+
`hdf5` reads HDF5 datasets (most of them), `eval` adds PyTorch for the deep-learning baselines, and `plot` adds matplotlib for the plots. `pip install "mlsca-bench[all]"` adds every dataset reader and download backend (everything except PyTorch). If a dataset needs an extra you have not installed, the error message names it.
|
|
100
|
+
|
|
101
|
+
A few datasets are archives that need a system tool: the six AES-PTv2 datasets are RAR archives, and a few zip files need 7-Zip. Install [7-Zip](https://www.7-zip.org) (Windows; it also extracts the RAR archives), `brew install unar sevenzip` (macOS) or `apt-get install unar p7zip-full` (Debian/Ubuntu).
|
|
102
|
+
|
|
103
|
+
**Windows:** the DPA Contest v1 to v3 datasets contain file paths longer than 260 characters, which Windows only allows once long paths are enabled. The package tells you how when it is needed.
|
|
104
|
+
|
|
105
|
+
**Intel Macs:** PyTorch's last version for Intel Macs is 2.2, which needs Python 3.12 or older and NumPy 1. Install with `pip install "mlsca-bench[hdf5,eval,plot]" "numpy<2"` (everything without the `eval` extra works with any version).
|
|
106
|
+
|
|
107
|
+
## 1. Download and load a dataset
|
|
108
|
+
|
|
109
|
+
```python
|
|
110
|
+
from mlsca_bench import load_dataset
|
|
111
|
+
|
|
112
|
+
with load_dataset("ascadf", split="attack") as ds: # downloads once (4.4 GB), then cached
|
|
113
|
+
print(ds.shape, ds.available_fields) # (10000, 700) ['ciphertexts', 'keys', ...]
|
|
114
|
+
traces = ds.traces[:1000] # read lazily: only these rows
|
|
115
|
+
print(ds[0].plaintext, ds[0].key)
|
|
116
|
+
```
|
|
117
|
+
|
|
118
|
+
Find a dataset and check what it contains before downloading:
|
|
119
|
+
|
|
120
|
+
```bash
|
|
121
|
+
mlsca-bench list # all 64, with size and the fields they provide
|
|
122
|
+
mlsca-bench list --with plaintexts keys # only datasets that include plaintexts and keys
|
|
123
|
+
mlsca-bench info ascadf # metadata, download size and space needed, license, fields
|
|
124
|
+
mlsca-bench download ascadf # download without loading
|
|
125
|
+
mlsca-bench cache # what is downloaded, and how much space it uses
|
|
126
|
+
```
|
|
127
|
+
|
|
128
|
+
Every download is checked against a checksum, a damaged or interrupted download is repaired on the next call, the disk space is checked first, and a downloaded dataset loads without internet. Datasets are stored in your user cache folder; set `MLSCA_BENCH_DATA=/path/to/folder` to use another place. Already have the files? `load_dataset("ascadf", path="/data/ASCAD.h5")` uses them directly.
|
|
129
|
+
|
|
130
|
+
**Very large datasets** (17 are over 50 GB, up to 4 TB) can be downloaded in part:
|
|
131
|
+
|
|
132
|
+
```bash
|
|
133
|
+
mlsca-bench info ches-ctf-2020-spook-sw3 --files # the files at the source, with sizes
|
|
134
|
+
mlsca-bench download ches-ctf-2020-spook-sw3 --split attack # only the attack split (12.5 of 87.5 GB)
|
|
135
|
+
mlsca-bench download scaaml-ecc-gpam-cm0 --files info.json "train/0_*" # only matching files
|
|
136
|
+
```
|
|
137
|
+
|
|
138
|
+
In Python, `download_dataset(name, files="pattern")` does the same, and `load_dataset(name, split="attack")` downloads only that split where the splits are separate files (SMAesH, the CHES CTF 2020 Spook sets, SCAAML). A partly downloaded dataset loads from the files that are present. The command line asks before downloads over 50 GB.
|
|
139
|
+
|
|
140
|
+
## 2. Run a baseline
|
|
141
|
+
|
|
142
|
+
Deep-learning baselines (the `eval` extra) are trained and attacked with one call. The dataset's own profiling/attack split is used where the authors provide one, otherwise a fixed, seeded 70 / 15 / 15 split:
|
|
143
|
+
|
|
144
|
+
```python
|
|
145
|
+
from mlsca_bench.benchmark import LeakageModel
|
|
146
|
+
from mlsca_bench.models import run_attack
|
|
147
|
+
|
|
148
|
+
leakage = LeakageModel(byte=2) # ASCAD's traces cover key byte 2; the default is byte 0
|
|
149
|
+
mlp = run_attack("ascadf", model="mlp", leakage=leakage, epochs=10)
|
|
150
|
+
print(mlp.guessing_entropy[-1], mlp.ranks.traces_to_disclosure())
|
|
151
|
+
```
|
|
152
|
+
|
|
153
|
+
The classical attacks need no deep-learning install:
|
|
154
|
+
|
|
155
|
+
```python
|
|
156
|
+
from mlsca_bench.benchmark import run_classical
|
|
157
|
+
|
|
158
|
+
cpa = run_classical("cpa", "ascadf", leakage=leakage)
|
|
159
|
+
template = run_classical("template", "ascadf", leakage=leakage)
|
|
160
|
+
```
|
|
161
|
+
|
|
162
|
+
| Baseline | Name | Default training | Notes |
|
|
163
|
+
|---|---|---|---|
|
|
164
|
+
| MLP | `mlp` | Adam, lr 1e-3, 50 epochs, batch 128, z-scored traces (our default) | fast on a CPU |
|
|
165
|
+
| ASCAD MLP (Prouff et al., 2018) | `ascad_mlp` | RMSprop, lr 1e-5, 200 epochs, batch 100, raw traces | fast on a CPU |
|
|
166
|
+
| Zaid CNN (Zaid et al., TCHES 2020) | `zaid_cnn` | Adam with one-cycle schedule (max lr 5e-3), 50 epochs, batch 50, z-scored then scaled to [0, 1] | fine on a CPU |
|
|
167
|
+
| ASCAD CNN (Prouff et al., 2018) | `ascad_cnn` | RMSprop, lr 1e-5, 75 epochs, batch 200, raw traces | needs a GPU |
|
|
168
|
+
| CPA, DPA, templates | `cpa`, `dpa`, `template` | no training | NumPy only |
|
|
169
|
+
|
|
170
|
+
**Training settings.** Each deep-learning baseline is trained by default with the settings of its authors' reference code: [ANSSI's ASCAD code](https://github.com/ANSSI-FR/ASCAD) (`ASCAD_train_models.py`, the settings of the published `mlp_best` and `cnn_best` models) and [Zaid et al.'s code](https://github.com/gabzai/Methodology-for-efficient-CNN-architectures-in-SCA) (`ASCAD/N0=0/cnn_architecture.py` and its one-cycle schedule in `clr.py`). The weight initialisation and the optimizer constants follow those Keras scripts as well. One difference: Zaid et al. train on the first 45,000 ASCAD profiling traces and keep 5,000 for validation, while `run_attack` trains on all of them (`train_traces=45000` matches their setup). Any setting can be changed per call, e.g. `run_attack(..., epochs=10, lr=1e-4, optimizer="adam", scaling="standard")`; `get_training_settings("ascad_cnn")` shows the defaults and `result.training` the settings a run used. The raw-trace settings of the ASCAD models were made for ASCAD's 8-bit traces; for traces in other units, pass `scaling="standard"`. On ASCAD itself, `ascad_mlp` with `scaling="standard"` also needs fewer attack traces to find the key than with the original raw traces.
|
|
171
|
+
|
|
172
|
+
**Reproducing the baselines.** With these default settings, every deep-learning baseline finds the key of ASCAD (fixed key, `ascadf`, key byte 2) for each of three seeds. The numbers are the attack traces needed until the guessing entropy stays at 0 (100 random orderings of the 10,000 attack traces; one NVIDIA A100, PyTorch 2.14):
|
|
173
|
+
|
|
174
|
+
| Model | `seed=0` | `seed=1` | `seed=2` |
|
|
175
|
+
|---|---|---|---|
|
|
176
|
+
| `zaid_cnn` | 359 | 442 | 401 |
|
|
177
|
+
| `ascad_cnn` | 2,429 | 1,963 | 2,288 |
|
|
178
|
+
| `ascad_mlp` | 3,237 | 6,306 | 1,821 |
|
|
179
|
+
|
|
180
|
+
For example, `run_attack("ascadf", model="zaid_cnn", leakage=LeakageModel(byte=2), seed=0).ranks.traces_to_disclosure()` gives the first number. A run repeats exactly on the same hardware and software; another GPU, the CPU or another PyTorch version can give slightly different numbers.
|
|
181
|
+
|
|
182
|
+
Choose the device with `device="cuda"` (NVIDIA), `"mps"` (Apple silicon) or `"cpu"`; the default is CUDA if available, otherwise the CPU. Runs are seeded (`seed=0` by default) and repeat exactly. The default leakage model is the AES first-round S-box output of key byte 0 (256 classes); `LeakageModel(byte=2, leakage="hw")` targets byte 2 with the Hamming weight instead.
|
|
183
|
+
|
|
184
|
+
## 3. Guessing entropy, success rate and plots
|
|
185
|
+
|
|
186
|
+
Every attack returns the guessing entropy (the mean rank of the correct key, 0 = found) and the success rate against the number of attack traces, averaged over 100 random orderings of the attack traces:
|
|
187
|
+
|
|
188
|
+
```python
|
|
189
|
+
print(mlp.guessing_entropy) # one value per number of attack traces
|
|
190
|
+
print(mlp.success_rate)
|
|
191
|
+
print(mlp.ranks.traces_to_disclosure()) # traces needed until GE stays at 0
|
|
192
|
+
|
|
193
|
+
from mlsca_bench.benchmark.plots import plot_guessing_entropy, plot_success_rate
|
|
194
|
+
|
|
195
|
+
plot_guessing_entropy({"mlp": mlp, "cpa": cpa, "template": template}, save="ge.png")
|
|
196
|
+
plot_success_rate({"mlp": mlp, "cpa": cpa, "template": template}, save="sr.png")
|
|
197
|
+
```
|
|
198
|
+
|
|
199
|
+
To compute them from your own predictions, use `guessing_entropy(probabilities, hypothesis_labels, correct_key)` and `success_rate(...)` from `mlsca_bench.benchmark.metrics`.
|
|
200
|
+
|
|
201
|
+
## 4. Add your own dataset
|
|
202
|
+
|
|
203
|
+
Describe your file once, then use the name everywhere: `load_dataset`, `run_attack`, `run_classical`.
|
|
204
|
+
|
|
205
|
+
```python
|
|
206
|
+
from mlsca_bench import register_dataset
|
|
207
|
+
|
|
208
|
+
register_dataset(
|
|
209
|
+
"my-lab-aes",
|
|
210
|
+
{
|
|
211
|
+
"adapter": "hdf5",
|
|
212
|
+
"adapter_config": {
|
|
213
|
+
"splits": {"all": "/"},
|
|
214
|
+
"traces_dataset": "traces",
|
|
215
|
+
"field_aliases": {"plaintexts": ["metadata/plaintext"], "keys": ["metadata/key"]},
|
|
216
|
+
},
|
|
217
|
+
"metadata": {"format": "hdf5", "algorithm": "AES-128", "measurement": "power"},
|
|
218
|
+
},
|
|
219
|
+
path="/data/my_traces.h5",
|
|
220
|
+
save=True, # remember it in every future session
|
|
221
|
+
)
|
|
222
|
+
|
|
223
|
+
mlp = run_attack("my-lab-aes", model="mlp", epochs=10)
|
|
224
|
+
```
|
|
225
|
+
|
|
226
|
+
The entry is checked when you register it, and a misspelled field or reader names what was expected. Readers exist for HDF5, NumPy, MATLAB, Riscure `.trs`, raw binary and more; [using your own dataset](https://github.com/essec-lab/mlsca-bench/blob/main/documentation/your-own-dataset.md) shows each option. `mlsca-bench forget my-lab-aes` removes a saved dataset (your files are kept).
|
|
227
|
+
|
|
228
|
+
## 5. Add your own model
|
|
229
|
+
|
|
230
|
+
A model is a function that receives the trace length and the number of classes and returns a PyTorch module:
|
|
231
|
+
|
|
232
|
+
```python
|
|
233
|
+
import torch.nn as nn
|
|
234
|
+
from mlsca_bench.models import register_model, run_attack
|
|
235
|
+
|
|
236
|
+
@register_model("my_cnn")
|
|
237
|
+
def my_cnn(*, input_length: int, n_classes: int, channels: int = 16):
|
|
238
|
+
return nn.Sequential(
|
|
239
|
+
nn.Unflatten(1, (1, input_length)),
|
|
240
|
+
nn.Conv1d(1, channels, kernel_size=11, padding=5), nn.ReLU(), nn.AvgPool1d(2),
|
|
241
|
+
nn.Flatten(), nn.Linear(channels * (input_length // 2), n_classes),
|
|
242
|
+
)
|
|
243
|
+
|
|
244
|
+
result = run_attack("ascadf", model="my_cnn", model_kwargs={"channels": 32},
|
|
245
|
+
leakage=LeakageModel(byte=2), epochs=10)
|
|
246
|
+
```
|
|
247
|
+
|
|
248
|
+
It is then trained, attacked and scored exactly like the baselines, with Adam, lr 1e-3, 50 epochs, batch 128 and z-scored traces unless you say otherwise. To give your model its own defaults, register it with `register_model("my_cnn", training=TrainingSettings(optimizer="rmsprop", lr=1e-5, epochs=100, batch_size=200, scaling="none", source="my paper"))` (`TrainingSettings` is in `mlsca_bench.models`). The built-in names cannot be replaced by accident.
|
|
249
|
+
|
|
250
|
+
## The datasets
|
|
251
|
+
|
|
252
|
+
64 public datasets covering 12 algorithms (AES-128, AES-256, DES, PRESENT, Ascon-128, Clyde-128, ECC, Curve25519, Ed25519, Dilithium, BLISS and CRYSTALS-Kyber) on Arm Cortex-M, Arm Cortex-A, AVR and RISC-V microcontrollers, FPGAs and ASICs, with power and electromagnetic measurements, about 13 TB in total. `mlsca-bench list` and `mlsca-bench info NAME` show each one.
|
|
253
|
+
|
|
254
|
+
- **What they contain:** 61 of the 64 were downloaded and loaded from their real files (the largest on one file each), and the fields seen there are listed by `mlsca-bench list` ("?" = not checked yet).
|
|
255
|
+
- **Licenses and terms of use:** MLSCA-Bench does not host or redistribute any dataset. Each is downloaded from its original source and stays under its authors' terms: cite the original work, and check the license with `mlsca-bench info NAME` (for example, `aes-rd` is for non-commercial use only). Where no license is stated, ask the authors before redistributing the data.
|
|
256
|
+
- **Known problems in the published data**, such as empty records or a file that duplicates another dataset, are listed in [known dataset issues](https://github.com/essec-lab/mlsca-bench/blob/main/documentation/known-dataset-issues.md).
|
|
257
|
+
|
|
258
|
+
## Contributing
|
|
259
|
+
|
|
260
|
+
New datasets and models are welcome; see [CONTRIBUTING.md](https://github.com/essec-lab/mlsca-bench/blob/main/CONTRIBUTING.md).
|
|
261
|
+
|
|
262
|
+
## Contact
|
|
263
|
+
|
|
264
|
+
- Iris Dania Jimenez: iris.jimenez AT unibw.de
|
|
265
|
+
- Michael Hutter: michael.hutter AT unibw.de
|
|
266
|
+
|
|
267
|
+
## License / copyright
|
|
268
|
+
|
|
269
|
+
Copyright © 2026 Universität der Bundeswehr München / Research Institute CODE - ESSEC Lab.
|
|
270
|
+
|
|
271
|
+
The code is licensed under the Apache License, Version 2.0; see [LICENSE](https://github.com/essec-lab/mlsca-bench/blob/main/LICENSE) and the SPDX headers in each file. The datasets are not part of MLSCA-Bench: each is downloaded from its original source and stays under its authors' terms (see [The datasets](#the-datasets)).
|