部分算法图来自Remove Some Noise: On Pre-processing of Side-channel Measurements with Autoencoders[1]

随机延迟

Desynchronization

随机延迟

1
2
3
4
5
6
7
8
9
10
11
from mlscat import security as sec

traces = np.array([[1,2,3,4,5,6,7,8,9,1,2,3,4,5,6,7,8,9,1,2,3,4,5,6,7,8,9],[1,2,3,4,5,6,7,8,9,1,2,3,4,5,6,7,8,9,1,2,3,4,5,6,7,8,9]])

sec.desynchronization(traces, 20)

result:
array([[0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 1., 2., 3.,
4., 5., 6., 7., 8., 9., 1., 2., 3., 4., 5.],
[0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 1.,
2., 3., 4., 5., 6., 7., 8., 9., 1., 2., 3.]])

混洗

shuffling

Shuffling

1
2
3
4
5
6
7
8
9
from mlscat import security as sec
import numpy as np

traces = np.array([[1,2,3,4,5,6,7,8,9],[1,2,3,4,5,6,7,8,9]])
sec.shuffling(traces, 2)

result:
array([[5, 3, 2, 4, 1, 6, 7, 8, 9],
[2, 1, 3, 4, 5, 6, 7, 8, 9]])

噪声

Gaussian noise

高斯噪声

1
2
3
4
5
6
7
8
9
10
from mlscat import security as sec

traces = np.array([[1,2,3,4,5],[1,2,3,4,5]])
sec.add_gaussian_noise(traces, 20)

result:
array([[ 19.55069733, -14.02830505, 5.82666492, 13.60338306,
-2.73098755],
[ -5.00718689, -13.57927608, -28.39710617, 3.92870256,
29.85302353]])

  1. L. Wu and S. Picek, “Remove Some Noise: On Pre-processing of Side-channel Measurements with Autoencoders,” IACR Transactions on Cryptographic Hardware and Embedded Systems, pp. 389–415, Aug. 2020, doi: 10.13154/tches.v2020.i4.389-415. ↩︎