As of August 2020 the site you are on (wiki.newae.com) is deprecated, and content is now at rtfm.newae.com.

Changes

Jump to: navigation, search

Training

939 bytes added, 21:33, 6 August 2018
DPA Lab Slides
[[:File:3.1 - DPA Lab 1B (Basic AES Attack) DPA Attack.pptx]]
 
<SyntaxHighlight>
from chipwhisperer.common.api.CWCoreAPI import CWCoreAPI
from matplotlib.pylab import *
import numpy as np
 
cwapi = CWCoreAPI()
cwapi.openProject(r'/home/cwuser/chipwhisperer/projects/dpa_dem.cwp')
 
tm = cwapi.project().traceManager()
ntraces = tm.numTraces()
npoints = tm.numPoints()
 
#We will store 0-guess here
zeroguess = np.zeros((1,npoints))
 
#We will store 1-guess here
oneguess = np.zeros((1,npoints))
 
bytenum = 0
bit = 0
##BITWISE GUESS STARTS HERE
 
#Count 1 and 0 for averaging
numone = 0
numzero = 0
 
#Do each trace loop
for n in range(0, ntraces):
trace = tm.getTrace(n)
tin = tm.getTextin(n)
if tin[bytenum] & (1<<bit):
oneguess += trace
numone += 1
else:
zeroguess += trace
numzero += 1
 
oneguess = oneguess / float(numone)
zeroguess = zeroguess / float(numzero)
 
diff = (oneguess - zeroguess).T
 
plot(diff)
show()
</SyntaxHighlight>
Approved_users, bureaucrat, administrator
1,956
edits

Navigation menu