Hi,
I’m running the CPA tests (from the tutorial) on the Spartan 6 UFO board for CW Lite. Since we’re really finding the correct round 10 key, the PGE vs Traces plot doesn’t come out right. So this is perhaps more of a Python question, cause I’m not really sure how to change the code to make it right (I’m very new to Python). The code I’ve used to plot is the following:
import holoviews as hv
import holoviews as hv
hv.extension('bokeh')
from tqdm import tnrange
def byte_to_color(idx):
return hv.Palette.colormaps['Category20'](idx/16.0)
plot_data = cwa.analyzer_plots(results)
ret = plot_data.pge_vs_trace(0)
curve = hv.Curve((ret[0],ret[1]), "Traces Used in Calculation", "Partial Guessing Entropy of Byte")
for bnum in tnrange(1, 16):
ret = plot_data.pge_vs_trace(bnum)
curve *= hv.Curve((ret[0],ret[1])).opts(color=byte_to_color(bnum))
curve.opts(width=900, height=600)
The same goes for the Max Correlation vs Iteration Number plots:
import numpy as np
a = []
b = []
for bnum in tnrange(0, 16):
data = plot_data.corr_vs_trace(bnum)
best = [0] * len(data[1][0])
for i in range(255):
if i == key[bnum]:
a.append(np.array(data[1][i]))
else:
if max(best) < max(data[1][i]): best = data[1][i]
b.append(np.array(data[1][i]))
pda = pd.DataFrame(a).transpose().rename(str, axis='columns')
pdb = pd.DataFrame(b).transpose().rename(str, axis='columns')
curve = hv.Curve(pdb['0'].tolist(), "Iteration Number", "Max Correlation").options(color='black')
for i in tnrange(1,len(pdb.columns)):
curve *= hv.Curve(pdb[str(i)]).options(color='black')
for i in tnrange(len(pda.columns)):
curve *= hv.Curve(pda[str(i)]).options(color=byte_to_color(i))
curve.opts(width=900, height=600)
How do I need to change the code snippets to get the correct plots?