# Side-Channel Power Analysis Based on SA-SVM
## 3 SVM Classifier Based on SA  
Figure 3 depicts the side-channel power attack method based on SA-SVM. DPA Contest is a globally recognized standard competition in the field of cryptographic security, and the latest version is DPA Contest v4. Since complete encryption was not used in this experiment, DPA Contest v4.1 was selected as the dataset. In the profiling phase, the original dataset is preprocessed, including labeling, feature extraction, and selection. Data processing is explained in Section 2.1. The following kernel functions were chosen for training the SVM classifier: the linear kernel, the RBF kernel, the Morlet wavelet kernel, the Mexican hat wavelet kernel, and the Morlet-RBF kernel. The SA-SVM algorithm optimizes the penalty factor and kernel parameter. The SA-SVM model is trained using the preprocessed training data in the end stage of the profiled phase to model the power consumption of attacker-owned devices. In the attack phase, the trained SVM model determines the probability of the traces for classes \(\ c_{0},\ \dots,c_{\mathcal{S}}\) based on the test set. Finally, for each hypothetical value, its log-likelihood is summed up, and the key is predicted. In addition to the Morlet-RBF kernel, SA-SVM defines a set of states for the kernel, where each state includes the penalty factor \(c1,\ c2\) and the kernel parameter \(sigma1,\ sigma2\). For the Morlet-RBF kernel, a set of states includes the penalty factor \(c1,\ c2\), and the kernel parameter \(sigma1\ sigma2,gamma1\ gamma2\). The state-generating function of SA-SVM generates a set of neighbors in the search range. The discrepancy between the initial parameter value and the parameter value of its adjacent state is large at first, but it decreases as the algorithm iterates. At a certain temperature, each iteration will choose a neighbor state at random. If the selected adjacent state outperforms the current state, the state is adopted, and its parameter values (\(c\) and \(sigma\)) are replaced with new parameter values. Otherwise, the adjacent state is adopted with a probability. (Algorithm 1 requires 12-13 lines of code.) Figure 3: The side-channel power attack process based on SA-SVM. The user needs to customize the parameters of the cooling system, including the length of the Markov chain \(L\), the attenuation coefficient \(\alpha\), the initial temperature, and the termination temperature T\({}_{0}\), \(T_{end}\). The relevant settings are as follows:  
1. Set the initial temperature T\({}_{0}\): T\({}_{0}\) influences the global search capability. A higher T\({}_{0}\) results in a more powerful, albeit more time-consuming, global search ability;
2. Set the length of the Markov chain \(L\) (internal loop): the more iterations there are at \(T_{i}\), the more time-consuming the process becomes;
3. Set the temperature attenuation coefficient \(\alpha\) (external circulation): 1. Exponential attenuation method: \(T_{i+1}=\alpha T_{i}\); 2. Classical annealing method: \(T_{i+1}=T_{i}/\ln(1+T_{i})\); 3. Fast annealing method: \(T_{i+1}=T_{i}/(1+\alpha T_{i})\). 4. Set the search range for the set of states: the initial solution has no effect on the final result, and it can be chosen at random in the solution set. The solution's search range should be reasonable in relation to the actual issue;
5. Set the termination condition: when the number of iterations \(L\) is achieved, the inner loop is terminated. If the optimal solution obtained by consecutively cooling several times remains unchanged, or T\({}_{i}\) drops to T\({}_{end}\), the external circulation stops. The specific process of the proposed SA-SVM is presented in Algorithm 1.