calculate variance, sample mean


#1

Hello, I’m trying to demonstrate the welch t-test for aes 128 in chipwhisperer. Is there any way to calculate the variance and the sample mean of the traces in my script? How could that be done? Do I have to load the commands in python console or there is another way?

Can anyone help me?
I would appreciate it a lot!!


#2

Hi papafra,

Easiest way would be to write a script,. You could write a script to perform the welch t-test using scipy.stats.ttest_ind and the traces you captured. The Manual CPA tutorial is a good example of working with the traces you captured. It gives an example of loading the traces once saved to have them accessible in the script as arrays that can be given to the welch T-test function. Hope this helps! :smiley:

Cheers,
Franz


#3

Hi Franz,
Thank you for your answer. I’ve captured the traces for aes and managed to load them in a script as you told me.My problem now is the fact that I don’t know how to separate the traces into two groups in order to measure the variance and mean of them. I tried to see tutorial B4 but is currently out of order and I cannot find any help.Have you got something to suggest me???


#4

Hi papafra:

suppose you have 10 traces,
and you want to separate them into 2 groups:[0,2,4,6,8] & [1,3,5,7,9]
Here is what you can do to extract the traces you want:

Traces = np.load('traces.npy')
Group1 = [0,2,4,6,8]    # list of the 1st group
Group2 = [1,3,5,7,9]    # list of the 2nd group
Traces_g1 = Traces[Group1]
Traces_g2 = Traces[Group2]

~ Hope this is helpful ~

Eric


#5

well I have already captured a brunch of traces for aes-128 in my own script. I have separated them into two groups Group1 and Group2 (Group1 contains traces with fixed-plaintext and Group2 contains traces with random plaintext).
In order to run welch t-test I must compute variances, means e.t.c. of these groups.Since I have loaded them into my script with the “np.load(’/path to traces/.npy’)” command I don’t know the way to gain access in each of these two groups I have made. What is the way to gain access in these groups so as to be able to execute welch t-test?

Any ideas please?