A simple model that fits the ASCAD data quite well is provided below, with some scripts that allow comparison with the original ASCAD trained models.

To check out the simple model, you can proceed as follows:

- Download the ASCAD database as described in the README.md file in the ASCAD GitHub repository.
- Install Python3 and packages required to work with the ASCAD models, in particular: numpy, matplotlib, h5py, keras, tensorflow, etc.
- Download the following tarball from this website, containing the simple model: simple_model.tgz
- Go to the ASCAD directory that contains the subfolder
ASCAD_data with the ASCAD database and trained models, and
unpack the contents of simple_model.tgz into that directory
(i.e. above ASCAD_data). You will obtain the following new files:

**Filename**

**Contents**

AES_Sbox.py

AES S-Box table used by run_models.py

run_models.py

Script that runs tests with two ASCAD models and the simple model

ascad_best_mlp.py

Wrapper for ASCAD "best MLP" model

ascad_best_cnn.py

Wrapper for ASCAD "best CNN" model

simple_model.py

The simple model presented here

simple_model.bin

Numpy arrays used in the simple model

- Run the test script with a command like:
`python3 run_models.py`

If you are patient enough to run a command like

The simple model is implemented in simple_model.py as follows:

Assembling a pile of numbers as in simple_model.bin is left as an exercise to the reader (it is less than 48 KByte).import numpy as np

f = open('simple_model.bin', 'rb')

pr = np.fromfile(f, dtype=np.float32, count=10*700).reshape(700,10)

mR = np.fromfile(f, dtype=np.float32, count=10*256).reshape(256,10)

mX = np.fromfile(f, dtype=np.float32, count=10*256).reshape(256,10)

f.close()

S = np.tile(np.arange(0x100, dtype = np.uint8).reshape(1,256), (256,1))

R = np.tile(np.arange(0x100, dtype = np.uint8).reshape(256,1), (1,256))

X = S ^ R

m = mR[R,:] + mX[X,:]

def predict(batch):

upr = batch.dot(pr).reshape(-1,1,1,10)

return np.exp(-.5 * ((upr - m) ** 2).sum(3)).sum(1)