import trsfile from trsfile.parametermap import TraceSetParameterMap import trsfile.traceparameter as tp import matplotlib.pyplot as plt import sys import numpy as np from scipy import stats from tqdm import tqdm if __name__ == "__main__": tracesetFilename = "traces/Xoodyak_FVR3000_20240214_124156.npz" knownKey = bytes.fromhex("CAFEBABEDEADBEEF0001020304050607") # the correct key npzfile = np.load(tracesetFilename) N = 1500 # number of traces to attack (less or equal to the amount of traces in the file) Nskip = 0 #number of traces to skip to avoid warning in correlation for division by 0 SboxNum = 0 # S-box to attack, counting from 0 data = npzfile['data'][:N+Nskip,SboxNum] # selecting only the required plaintext byte traces = npzfile['traces'][:N,:250000] plt.figure() plt.plot(traces[1]) plt.plot(traces[199]) plt.xlabel("Time") plt.ylabel("Values") plt.title("Read Traces") plt.legend() plt.show()