SPECK cipher side channel attack method based on cosine similarity power analysis
By employing standardized preprocessing, a hierarchical leakage model, and cosine similarity calculation, the problems of noise interference and high computational complexity in side-channel attacks on the SPECK cryptographic algorithm are solved, achieving efficient and reliable key cracking and improving attack efficiency and engineering practicality.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- XIDIAN UNIV
- Filing Date
- 2026-03-27
- Publication Date
- 2026-06-12
AI Technical Summary
Existing technologies for side-channel attacks on the SPECK cryptographic algorithm face severe noise interference, high computational complexity, large sample requirements, and a lack of quantitative evaluation systems, resulting in low key guessing accuracy and excessive computational resource consumption.
Standardized preprocessing and moving average filtering techniques are used to improve data quality. A hierarchical leakage model adapted to the SPECK algorithm is designed. Cosine similarity is used to replace Pearson correlation coefficient. Guessing entropy and success rate are introduced as core metrics to construct a multi-parameter quantitative evaluation system.
It significantly reduces sample requirements, improves the accuracy and computational efficiency of key guessing, reduces data collection costs and time consumption, and enhances the robustness and credibility of attacks.
Smart Images

Figure CN122204282A_ABST
Abstract
Description
Technical Field
[0001] This invention belongs to the field of electronic information processing technology, and further relates to a SPECK cryptographic side-channel attack method based on cosine similarity power analysis (CSPA) in the field of cryptography and information security technology. This invention can be used for security evaluation of cryptographic chips, testing the resistance to side-channel attacks of cryptographic algorithms, and security auditing of cryptographic implementations in resource-constrained environments such as IoT devices and embedded systems. Background Technology
[0002] With the acceleration of global digitalization, the Internet of Things (IoT), the Industrial Internet, smart wearable devices, and edge computing nodes have been deeply integrated into core areas such as smart cities, smart healthcare, and smart manufacturing. In these application scenarios, terminal devices typically face extremely stringent resource constraints, including limited computing power, limited storage space, and low-power operation requirements. To ensure the confidentiality and integrity of data in these constrained scenarios, side-channel attack techniques targeting lightweight block ciphers have emerged.
[0003] Guangdong Vocational and Technical College disclosed a side-channel analysis method for the SMBA symmetric encryption algorithm in its patent application, "Side-channel attack method and related equipment for SMBA encryption algorithm based on CPA" (application number: 202511329218.6, publication number: CN 121261892 A). This method includes: acquiring side-channel leakage information, such as power consumption curves, current curves, or electromagnetic signals, from the cryptographic chip during the SMBA algorithm operation using a acquisition probe and a programmable oscilloscope; selecting the whitening transformation result in the round function of the SMBA encryption algorithm as the attack intermediate value; calculating the corresponding intermediate value for each input data and the assumed encryption subkey, thereby constructing a complete set of intermediate values; and comparing the acquired side-channel leakage data with the constructed set of intermediate values to deduce and crack the encryption subkey of the SMBA encryption algorithm. This patent provides an effective evaluation method for the security of the SMBA algorithm in a real hardware environment, and can accurately locate the physical leakage points in the algorithm implementation. However, this scheme still has shortcomings. It relies heavily on capturing linear features during the whitening transformation stage. For SMBA implementations employing defense mechanisms such as high-order masks or dynamic random scrambling, the complexity of correlation calculations increases exponentially, leading to a significant decrease in attack success rate. Furthermore, when dealing with high-frequency environmental noise or clock jitter interference, this method often requires an extremely large number of power trace samples for preprocessing and alignment. In practical attack scenarios, this is not only time-consuming and labor-intensive but also places extremely high demands on the sampling bandwidth and signal-to-noise ratio of the hardware acquisition equipment. Existing side-channel attacks against the Speck cryptographic algorithm require attackers to capture data through eavesdropping or other methods, but capturing data requires more than 1300 power traces to completely break the cryptographic algorithm key in the attacking device.
[0004] Chengdu University of Information Technology disclosed a method for energy analysis-based side-channel attacks against the national commercial cryptographic algorithm SM2 in its patent application, "Method for Side-Channel Attacks Against SM2 Public-Key Cryptography Algorithm" (Application No.: 201510199567.0, Authorization Announcement No.: CN 104780051 B). The core process of this method includes: during the SM2 public-key encryption operation, avoiding complex elliptic curve multiplication operations, and instead selecting the XOR operation part of the encryption process as the attack point; using the message to be encrypted as the attack target, and using intermediate data as intermediate variables for the side-channel attack. By collecting the energy leakage at this stage and performing correlation analysis, the attacker can directly obtain the encrypted original information without knowing the private key. This patented technology effectively improves the correlation between the attacked information and the physical leakage signal by precisely locking the linear operation stage, enhancing the flexibility and success rate of the attack. However, the method still has shortcomings. Its attack target mainly focuses on decrypting the message content rather than the long-term private key itself, meaning that each attack is only effective for the current ciphertext and cannot completely crack the encryption system.
[0005] The SPECK cryptographic algorithm, designed by the U.S. National Security Agency (NSA) and a prominent contender in the NIST Lightweight Cryptography Standards (LSS) competition, employs a typical ARX (Addition-Rotation-XOR) architecture. Its core design leverages a highly concise round function to achieve high security. Due to its flexible configuration of various block and key lengths and extremely low hardware resource consumption, SPECK has become the preferred encryption solution for devices such as smart sensors, RFID tags, and embedded controllers. However, the underlying hardware devices running the SPECK algorithm are often designed with energy efficiency in mind, lacking robust physical layer security mechanisms in their circuit layout and logic implementation. This results in physical quantities that vary with the key due to the level shifts of internal logic gates during encryption and decryption operations. Side-channel attacks exploit this security blind spot, bypassing the dependence of traditional mathematical analysis on the algorithm's inherent logic. Attackers collect physical information such as energy consumption, electromagnetic radiation, execution time, or heat generation during device operation, and combine this information with statistical methods to establish a correlation between physical leakage and internal operands. This allows attackers to efficiently extract encryption keys without needing to crack the algorithm's mathematical logic. However, in actual data acquisition, energy trace data is highly sensitive and easily affected by the combined interference of target device circuit noise, power fluctuations, and environmental electromagnetic radiation. Effective standardized preprocessing and noise suppression methods are often lacking, leading to direct correlation calculations on the raw data. Because the Pearson Correlation Coefficient (PCC) is poorly robust to non-normally distributed data, the attack success rate becomes dramatically dependent on the sample size under noise interference. Since the SPECK algorithm uses a round-key incremental expansion architecture, there is a clear linear or non-linear correlation between keys. However, traditional attack schemes fail to fully utilize this recursive pattern, typically treating multi-byte keys as independent variables for iteration. The superposition of the Pearson correlation coefficient itself involves complex covariance and standard deviation calculations, with a computational complexity approaching... This disconnect between the algorithm's characteristics and the mathematical model leads to an exponential increase in computational complexity and extremely high memory consumption when processing large-scale energy traces or long keys, severely limiting the real-time performance of attacks. Existing schemes primarily use whether the correct key is guessed as the sole evaluation criterion. This evaluation method is a binary judgment and cannot objectively reflect the uncertainties in the key guessing process. Due to the lack of fine-grained quantitative indicators such as guessing entropy, researchers find it difficult to accurately describe the stability of the attack's effectiveness and cannot distinguish between a guaranteed crack and a chance hit when the sample size is insufficient, resulting in insufficient engineering practicality and scientific verifiability of the scheme. Summary of the Invention
[0006] The purpose of this invention is to address the shortcomings of the existing technologies by proposing a SPECK cryptographic side-channel attack method based on cosine similarity power analysis. This method aims to solve the problems faced by traditional side-channel attack schemes based on correlation power analysis in the SPECK cryptographic algorithm, where the original energy trace suffers from severe noise interference, directly leading to low accuracy in key guessing. Furthermore, traditional attack methods do not fully consider the correlation of leaked features in the SPECK algorithm across multiple rounds of encryption, resulting in computational redundancy when cracking multi-byte keys, wasting significant time, and lacking a quantitative evaluation system.
[0007] The technical approach to achieving the objectives of this invention is as follows: First, this invention improves data quality by constructing a preprocessing mechanism, employing a data processing mechanism that combines standardized preprocessing with moving average filtering. Dimensional normalization eliminates magnitude differences, and filtering techniques effectively suppress random noise. The core objective of this improvement is to enhance the signal-to-noise ratio of energy traces, thereby achieving high-precision calculations with fewer samples and reducing acquisition costs. This addresses the problem of poor noise resistance and high sample requirements of existing raw energy trace data. Second, this invention designs an adapted cascaded hierarchical leakage model tailored to the key expansion characteristics of the SPECK algorithm. It achieves progressive solving using cracked key information, eliminating redundant calculations. Simultaneously, in the similarity calculation stage, cosine similarity is used instead of the traditional Pearson correlation coefficient. Cosine similarity has better theoretical adaptability when processing the side-channel statistical characteristics of the SPECK algorithm, and the calculation process is simpler, significantly reducing system memory usage and improving the speed of cracking multi-byte keys. This solves the problem of extremely high computational complexity caused by the mismatch between the leakage model and algorithm characteristics, improving computational efficiency through hierarchical leakage model and similarity algorithm optimization. Finally, this invention introduces a multi-dimensional quantitative evaluation system to enhance the credibility of the scheme. Guessing entropy and success rate are introduced as core metrics at the end of the attack process. By constructing a quantitative evaluation system, the convergence trend and stability of the attack results can be clearly demonstrated. This not only provides a scientific basis for verifying the attack results but also enables accurate assessment of security risks in different environments during engineering applications, enhancing the practical value of the scheme. Addressing the deficiency of "ranking degradation under limited sample size": Existing technologies, under limited sample conditions, require analysis of the hypothesis leakage items... Mean-centered the actual energy trace $T$ (subtracting the mean center) and This method is prone to introducing the accumulation and propagation of mean estimation errors. This invention employs a decentralized cosine similarity algorithm to directly calculate the angle between the hypothesis vector and the observed vector in high-dimensional space. This approach avoids the interference of mean bias on relevance evaluation, making the scoring function more robust in small sample intervals and solving the problem of correct key order reversal caused by insufficient statistical separability. Addressing the shortcomings of "slow statistical convergence and high sample complexity": traditional methods, when dealing with lightweight ARX structures (such as SPECK), exhibit a high variance in the scoring function with increasing sample size. The convergence speed is relatively slow. This invention derives the relationship between sample complexity $N$ and the variance of the scoring function by optimizing the statistical distribution model. Proportional to, and with discrimination The square root of the result is inversely proportional. Experiments show that the cosine similarity scoring function has a statistical advantage in a zero-mean noise model. The speed of accumulation is more stable. Compared with traditional correlation power analysis (CPA) that traverses the entire space, this invention reduces the number of energy traces required to achieve a 100% success rate from 1300 to about 900, significantly improving the attack efficiency by about 30.8% and overcoming the shortcomings of existing technologies that consume too much sampling resources.
[0008] To achieve the above objectives, the specific implementation steps of the present invention include the following:
[0009] Step 1: Perform standardization preprocessing and moving average filtering on the collected SPECK power consumption energy traces;
[0010] Step 2: Design a hierarchical leakage model using the recursive nature of key expansion in the SPECK algorithm;
[0011] Step 3: Calculate the cosine similarity between the theoretical leakage vector corresponding to each guessed key and the preprocessed power consumption trace in each actual leakage vector, and perform waveform feature alignment.
[0012] Step 4: Determine the subkey based on the correlation coefficient, and construct a multi-parameter quantitative evaluation system using guessing entropy and success rate as core metrics.
[0013] Furthermore, the steps of the standardization preprocessing and moving average filtering are as follows:
[0014] The first step is to upload the SPECK cryptographic algorithm to the chip on the target board and collect the power consumption traces of the device to be attacked.
[0015] The second step is to calculate the mean and standard deviation of each power consumption energy trace, and then perform mean removal processing on each sampling point in each energy trace and divide by the standard deviation to obtain the normalized energy trace.
[0016] The third step is to limit the amplitude range of the normalized energy trace to avoid outliers affecting subsequent calculations.
[0017] The fourth step involves sliding the normalized energy trace through a window point by point on the time axis, and taking the average of all sampling points within each window as the smoothing result for that sampling point. The length of the window is set according to the sampling frequency and noise level to suppress high-frequency noise while maintaining the main features of the original signal without weakening it.
[0018] Furthermore, the hierarchical leakage model forms a cascading search mechanism through the following steps:
[0019] The first step is to split the complete key to be recovered into multiple logical levels according to the number of keys required for each layer of encryption. Each level corresponds to a subkey of different rounds or different bytes in the SPECK algorithm.
[0020] The second step is to use the value of the subkey corresponding to the correct state that was successfully recovered from the previous attack as the parameter input for the next layer when attacking the current subkey.
[0021] The third step involves using the key information already determined at this layer, combined with the ARX structure recursive formula of the algorithm, to perform cascade updates only on the unknown key bits of the next layer, calculate the theoretical assumptions of the intermediate variables of the next layer, and realize dynamic correlation modeling between layers.
[0022] The recursive formula for the ARX structure is as follows:
[0023] ;
[0024] ;
[0025] in, and These represent the attacks on the first... The input states of the left and right registers when using the +1 layer subkey. and These represent the attacks on the first... The correct state quantity recovered when using the sub-key. and These represent circular right shifts. Bitwise and circular left shift Bit, This represents a modulo addition operation. This indicates a bitwise XOR operation. This indicates the candidate key currently being searched.
[0026] The cascading update specifically includes:
[0027] Known state import: In the attack... When using the sub-key, the first... The correct state quantity recovered by the layer and As a deterministic input;
[0028] Intermediate value calculation: using the current candidate key to be searched Calculate using the ARX structure recursive formula The value;
[0029] Target extraction: The calculated results As the target intermediate value of the current attack layer, it is used for the mapping and generation of subsequent theoretical leakage vectors, thereby realizing the dynamic evolution of the attack path as the key recovery progresses.
[0030] Furthermore, the theoretical leakage vector corresponding to each guessed key refers to selecting the target intermediate value in each round of encryption in the SPECK cryptographic algorithm as the attack target, converting the target intermediate value into binary representation, and counting the number of "1"s in its binary bits as the corresponding leakage value; repeating the above calculation process for all input plaintext and candidate key combinations to generate the theoretical leakage vector corresponding to each guessed key, and the calculation formula is as follows:
[0031] ;
[0032] in, Indicates the target intermediate value The Hamming weight, where m represents the bit width of the target median value. This indicates the first intermediate value in the binary representation of the target value. Bit value.
[0033] Furthermore, the cosine similarity is obtained by the following formula:
[0034] ;
[0035] in, This represents the cosine similarity value of the k-th candidate key. Indicates the first The theoretical leakage value corresponding to each energy trace. Indicates the first A trace of energy. This represents the total number of energy traces.
[0036] Furthermore, the waveform feature alignment step is as follows:
[0037] The first step is to perform a dot product operation between the theoretical leakage vector and the actual power consumption vector at the corresponding time point to obtain the inner product value of the two vectors; at the same time, the Euclidean norm of the two vectors is calculated respectively; the inner product value is divided by the product of the norms of the two vectors to obtain the normalized similarity value, so that the score value under different attack windows is within the range of [0, 1].
[0038] The second step is to plot the normalized similarity values of all time sampling points in each guess key into a similarity curve, forming a correlation distribution map with timestamp as the horizontal axis and cosine similarity value as the vertical axis.
[0039] The third step is to traverse all time sampling points in the similarity curve, identify and extract the local maximum value in the curve as candidate feature peaks; in view of the narrow power consumption of the lightweight algorithm, peak alignment is performed within a preset time window to compensate for the time axis offset caused by sampling clock jitter or hardware delay.
[0040] The fourth step is to compare the characteristic peaks of the same guessed key in different time periods, select the global maximum value in the entire curve as the final relevance score of the guessed key, and record the time point index corresponding to the maximum value to ensure that the evaluation benchmarks between different key guesses are logically aligned in physical time.
[0041] Furthermore, the steps for determining the subkey based on the correlation coefficient and using guessing entropy and success rate as core metrics are as follows:
[0042] The first step is to select the maximum similarity value as the evaluation index of the candidate key from the time-sampled points of the similarity between the theoretical leakage vector and the actual power consumption vector of each candidate key; after traversing all candidate keys, select the candidate key with the maximum evaluation index as the current subkey.
[0043] The second step is to sort all candidate keys according to their corresponding similarity evaluation index and determine the position of the current subkey in the sorting result; this position is used as the guessing entropy value to measure the uncertainty of key guessing during the attack process.
[0044] Furthermore, the construction of the multi-parameter quantitative evaluation system refers to counting the number of times the correct key is successfully recovered in each independent side-channel attack, and using the ratio of this number to the total number of side-channel attacks as a success rate indicator to reflect the stability and reliability of the attack method.
[0045] Compared with the prior art, the present invention has the following advantages:
[0046] First, this invention employs a cosine similarity scheme instead of the Pearson correlation coefficient, constructing a data processing mechanism of standardized preprocessing and moving average filtering. This results in highly robust data after processing. Cosine similarity focuses only on vector direction, making it insensitive to common issues in practical implementations such as circuit noise, amplitude scaling of power traces, and DC bias, thus enhancing statistical analysis capabilities in low signal-to-noise ratio environments. Furthermore, in practical use, the processed data shows a reduction in the number of samples required for attacks, effectively overcoming the lack of robustness of the Pearson correlation coefficient to non-normal energy traces. This significantly reduces the number of energy trace samples required to achieve a reliable success rate, thereby lowering data acquisition costs and time consumption, and improving attack robustness.
[0047] Second, this invention designs a hierarchical leakage model adapted to the recursive key expansion characteristics of the SPECK algorithm, and replaces the Pearson correlation coefficient scheme, which requires covariance, with cosine similarity. The hierarchical leakage model avoids redundant computations during the attack process, and achieves a progressive solution for multi-byte keys based on the cracked key information. This overcomes the problem of existing leakage models not incorporating the SPECK key expansion characteristics, which requires independently traversing all key candidates, and avoids the exponential increase in computational load when cracking multi-byte keys. It also overcomes the inherent limitations of the Pearson correlation coefficient in existing technologies. The issue of computational complexity is addressed, and this invention significantly improves the efficiency of model attacks, resolving the computational bottleneck.
[0048] Third, this invention introduces guessing entropy and success rate as core metrics, constructing a multi-parameter quantitative evaluation system. Through credibility verification, it avoids the shortcomings of existing schemes that rely solely on whether the correct key is obtained as the sole qualitative evaluation indicator. This enables the new quantitative evaluation system to accurately reflect the uncertainty in the key guessing process, verifying the credibility of the attack effect, avoiding accidental hits, and enhancing the attack's credibility and engineering practicality.
[0049] Fourth, this invention derives the sample complexity by optimizing the statistical distribution model. With the variance of the scoring function Proportional to, and with discrimination The inverse square relationship overcomes the drawback of excessive sampling resource consumption in existing technologies. Simulation experiments demonstrate that the cosine similarity scoring function, under a zero-mean noise model, exhibits statistical advantage that... The speed of accumulation is more stable. Compared with the existing technology of full-space traversal CPA, the present invention reduces the number of energy traces required to achieve 100% success rate from 1300 to about 900, significantly improving the attack efficiency by about 30.8%. Attached Figure Description
[0050] Figure 1 This is a flowchart of the method of the present invention;
[0051] Figure 2 This is a graph showing the energy variation of the SPECK cryptographic algorithm of this invention.
[0052] Figure 3 This is a graph showing the energy variation of a single round of encryption using the SPECK cryptographic algorithm of this invention.
[0053] Figure 4 This is a heatmap of the Hamming weight, the intermediate value of the SPECK cryptographic algorithm of this invention.
[0054] Figure 5 This is a comparison diagram showing the convergence of the cosine similarity of the correct key bytes in the simulation experiment of this invention.
[0055] Figure 6 This is a comparison chart of the results of traditional Pearson correlation coefficient and cosine similarity attack in the simulation experiment of this invention.
[0056] Figure 7 This is a graph showing the trend of entropy change for the correct key guessing in the cosine similarity attack scheme during the simulation experiment of this invention. Detailed Implementation
[0057] The present invention will be further described below with reference to the accompanying drawings and embodiments.
[0058] Reference Figure 1 The implementation steps of the embodiments of the present invention will be further described below.
[0059] Step 1: Energy trace acquisition and standardized preprocessing data acquisition.
[0060] An embodiment of the present invention uses the Chipwhisperer platform to collect data on the SPECK algorithm in encryption. Known plaintext Power consumption traces leaked at time .
[0061] Reference Figure 2 The changes in encryption energy of the SPECK cryptographic algorithm of the present invention will be further described. Figure 2 The horizontal axis of the waveform represents the sampling points, and the vertical axis represents the amplitude values. The waveform clearly demonstrates the power consumption characteristics of the complete 22-round encryption cycle of the SPECK32 / 64 algorithm. The power consumption peaks in each round have a clear periodic distribution, providing a physical basis for locating subsequent attack points.
[0062] Reference Figure 3 , Figure 3 The waveform in the middle is an amplified time-domain energy waveform of the first round during the SPECK encryption process.
[0063] The collected energy traces are processed in the following two steps:
[0064] First, the energy trace is standardized and filtered. This involves processing the collected raw power consumption energy trace... The process involves two steps: dimensional normalization—standardizing the energy trace data to bring energy trace data of different amplitudes to the same dimension, eliminating the impact of amplitude differences and improving the accuracy of data calculation.
[0065] Secondly, the standardized energy trace is subjected to moving average filtering. The moving average filtering algorithm is used to perform time-domain filtering on the normalized energy trace, effectively suppressing circuit noise and environmental interference, and improving the data signal-to-noise ratio.
[0066] Step 2: Construct a hierarchical leakage model adapted to SPECK characteristics.
[0067] For a certain intermediate value in the first round of encryption operation of the SPECK algorithm (For example, the output value in the first round) A power leakage model is established, and the Hamming weight model is used in the embodiments of the present invention.
[0068] A layered leakage model is designed by leveraging the recursive nature of the SPECK algorithm's key expansion. This model is based on the compromised low-byte key information. To enable subsequent high-byte keys The solution is obtained through a progressive approach. For example, for the SPECK algorithm key, the lowest byte is cracked first. Then utilize Information optimization The guessing process avoids the traditional leakage model from affecting all... Independent traversal of key candidates reduces computational redundancy. Theoretical leak value calculation: For each hypothetical key... According to the known plaintext Calculate the theoretical intermediate value And convert it into a theoretical power leakage vector. .
[0069] Reference Figure 4 In the random plaintext encryption process, the Hamming weight distribution of the middle value output by the left branch of the SPECK algorithm in each round. Figure 4 The horizontal axis represents the encryption round, the vertical axis represents the Hamming weight value, and the color intensity represents the frequency of the HW value.
[0070] Step 3: Calculate cosine similarity correlation and select correlation indicators.
[0071] In the similarity coefficient calculation module, the cosine similarity scheme is selected instead of the Pearson correlation coefficient. Theoretically, cosine similarity is better suited to statistical analysis in side-channel attacks of the SPECK cryptographic algorithm and is insensitive to data amplitude scaling and DC bias.
[0072] Similarity calculation: For each guessed key The corresponding theoretical leakage vector , and pre-treated A streak of energy at a specific point in time The actual leakage vector on Calculate cosine similarity The formula for calculating cosine similarity is as follows:
[0073] ;
[0074] in, Indicates the number of energy traces. Indicates the trace index. Indicates a point-in-time index.
[0075] Step 4, Key Recovery and Multi-parameter Quantitative Evaluation of Key Recovery.
[0076] Iterate through all time points Find the peak value of the maximum cosine similarity. Corresponding guessing key The highest similarity peak That is, the subkey that is determined to be correct. Multi-parameter quantitative evaluation: At the end of the side-channel attack process, guessing entropy and success rate are introduced as core metrics. By calculating the changes in guessing entropy and success rate with the number of energy traces, a multi-parameter quantitative evaluation system is constructed to achieve accurate characterization and verification of the credibility of the attack effect. This quantitative evaluation system overcomes the shortcomings of existing schemes that only use whether the correct key is obtained as the sole qualitative indicator, enhancing the engineering practicality of the scheme.
[0077] The effects of this invention will be further illustrated below with simulation experiments:
[0078] To further demonstrate the scientific validity of the technical approach described in this invention, the algorithm performance was quantitatively analyzed through simulation experiments.
[0079] 1. Simulation conditions and environment setup.
[0080] The simulation experiments of this invention use the SPECK-32 / 64 algorithm as the object, and are run on an Intel Core i7 processor and Python 3.9 environment. A mean of 0 and a variance of are injected into the original power leakage model. Gaussian white noise was used to simulate a real hardware environment. The sample set size was set to 2000 energy traces.
[0081] 2. Simulation content and control design.
[0082] The simulation experiments of this invention compare the performance of the traditional Pearson correlation coefficient and the non-centered cosine similarity proposed in this invention under the same noise intensity. This invention derives the sample complexity by optimizing the statistical distribution model. With the variance of the scoring function Proportional to, and with discrimination The square root of the result is inversely proportional. The experiment focuses on observing the convergence speed of the two algorithms when the guess entropy drops to 1, and the stability of the scoring function as the sample size increases.
[0083] 3. Analysis of simulation results.
[0084] Under the zero-mean noise model, the statistical advantages of this invention are as follows: The speed of accumulation is stable. Compared with the existing technology of full-space traversal CPA, the number of energy traces required to achieve a 100% success rate is reduced from 1300 to about 900, significantly improving the attack efficiency by about 30.8%, and overcoming the shortcomings of the existing technology in consuming too many sampling resources. Because this invention avoids the propagation of mean estimation error, its scoring curve is more stable in small sample intervals. The fluctuations are significantly smaller than those of the traditional PCC method, demonstrating that this technique has stronger robustness in resource-constrained scenarios.
[0085] Reference Figure 5 The convergence of the cosine similarity of the correct key bytes in the simulation experiment diagram of this invention is further demonstrated. Figure 5 The horizontal axis represents the number of energy traces, and the vertical axis represents the cosine similarity value of the correct key. The cosine similarity value shows a convergence trend with the number of energy traces. Specifically, complete convergence is achieved in the first four rounds with approximately 600 energy traces, and in the last four rounds with approximately 1000 energy traces. This demonstrates that the cosine similarity scoring function used in this invention maintains extremely high statistical stability when dealing with layered attacks on the SPECK algorithm, and the keys in each round exhibit monotonically increasing convergence characteristics without significant structured degradation.
[0086] Reference Figure 6 The simulation experiment diagram of this invention further demonstrates the attack results using the traditional Pearson correlation coefficient method and the cosine similarity method of this invention. Figure 6The horizontal axis represents the number of energy traces, and the vertical axis represents the attack success rate. The attack performance of the improved cosine similarity algorithm in this invention is compared with that of the Pearson correlation coefficient on samples of equal energy traces. This demonstrates that, under limited sample size, the decentralized cosine similarity algorithm has higher attack efficiency and noise resistance.
[0087] Reference Figure 7 The simulation experiment of this invention further demonstrates the trend of entropy change in correct key guessing using the cosine similarity attack scheme. Figure 7 The horizontal axis represents the number of energy traces, and the vertical axis represents the guessing entropy. The improved cosine similarity algorithm of this invention converges under different energy trace samples. This demonstrates that the scheme described in this invention has extremely high determinism and reliability in recovering the SPECK algorithm key.
Claims
1. A SPECK cryptographic side-channel attack method based on cosine similarity power analysis, characterized in that, The steps of this method include the following: Step 1: Perform standardization preprocessing and moving average filtering on the collected SPECK power consumption energy traces; Step 2: Design a hierarchical leakage model using the recursive nature of key expansion in the SPECK algorithm; Step 3: Calculate the cosine similarity between the theoretical leakage vector corresponding to each guessed key and the preprocessed power consumption trace in each actual leakage vector, and perform waveform feature alignment. Step 4: Determine the subkey based on the correlation coefficient, and construct a multi-parameter quantitative evaluation system using guessing entropy and success rate as core metrics.
2. The SPECK cryptographic side-channel attack method according to claim 1, characterized in that, Step 1 The steps of the standardization preprocessing and moving average filtering described in the article are as follows: The first step is to upload the SPECK cryptographic algorithm to the chip on the target board and collect the power consumption traces of the device to be attacked. The second step is to calculate the mean and standard deviation of each power consumption energy trace, and then perform mean removal processing on each sampling point in each energy trace and divide by the standard deviation to obtain the normalized energy trace. The third step is to limit the amplitude range of the normalized energy trace to avoid outliers affecting subsequent calculations. The fourth step involves sliding the normalized energy trace through a window point by point on the time axis, and taking the average of all sampling points within each window as the smoothing result for that sampling point. The length of the window is set according to the sampling frequency and noise level to suppress high-frequency noise while maintaining the main features of the original signal without weakening it.
3. The SPECK cryptographic side-channel attack method according to claim 1, characterized in that, The hierarchical leakage model described in step 2 forms a cascading search mechanism through the following steps: The first step is to split the complete key to be recovered into multiple logical levels according to the number of keys required for each layer of encryption. Each level corresponds to a subkey of different rounds or different bytes in the SPECK algorithm. The second step is to use the value of the subkey corresponding to the correct state that was successfully recovered from the previous attack as the parameter input for the next layer when attacking the current subkey. The third step involves using the key information already determined at this layer, combined with the ARX structure recursive formula of the algorithm, to perform cascade updates only on the unknown key bits of the next layer, calculate the theoretical assumptions of the intermediate variables of the next layer, and realize dynamic correlation modeling between layers.
4. The SPECK cryptographic side-channel attack method according to claim 3, characterized in that, The recursive formula for the ARX structure is as follows: ; ; in, and These represent the attacks on the first... The input states of the left and right registers when using the +1 layer subkey. and These represent the attacks on the first... The correct state quantity recovered when using the sub-key. and These represent circular right shifts. Bitwise and circular left shift Bit, This represents a modulo addition operation. This indicates a bitwise XOR operation. This indicates the candidate key currently being searched.
5. The SPECK cryptographic side-channel attack method according to claim 4, characterized in that, The cascading update specifically includes: Known state import: In the attack... When using the sub-key, the first... The correct state quantity recovered by the layer and As a deterministic input; Intermediate value calculation: using the current candidate key to be searched Calculate using the ARX structure recursive formula The value; Target extraction: The calculated results As the target intermediate value of the current attack layer, it is used for the mapping and generation of subsequent theoretical leakage vectors, thereby realizing the dynamic evolution of the attack path as the key recovery progresses.
6. The SPECK cryptographic side-channel attack method according to claim 5, characterized in that, Step 3 The theoretical leakage vector for each guessed key, as described above, is generated by selecting the target intermediate value in each round of encryption in the SPECK cryptographic algorithm as the attack target, converting this target intermediate value into binary representation, and counting the number of "1"s in its binary bits as the corresponding leakage value. This calculation process is repeated for all input plaintext and candidate key combinations to generate the theoretical leakage vector for each guessed key. The calculation formula is as follows: ; in, Indicates the target intermediate value The Hamming weight, where m represents the bit width of the target median value. This indicates the first intermediate value in the binary representation of the target value. Bit value.
7. The SPECK cryptographic side-channel attack method according to claim 6, characterized in that, Step 3 The cosine similarity mentioned above is obtained by the following formula: ; in, This represents the cosine similarity value of the k-th candidate key. Indicates the first The theoretical leakage value corresponding to each energy trace Indicates the first A trace of energy. This represents the total number of energy traces.
8. The SPECK cryptographic side-channel attack method according to claim 7, characterized in that, The waveform feature alignment steps in step 3 are as follows: The first step is to perform a dot product operation between the theoretical leakage vector and the actual power consumption vector at the corresponding time point to obtain the inner product value of the two vectors; at the same time, the Euclidean norm of the two vectors is calculated respectively; the inner product value is divided by the product of the norms of the two vectors to obtain the normalized similarity value, so that the score value under different attack windows is within the range of [0, 1]. The second step is to plot the normalized similarity values of all time sampling points in each guess key into a similarity curve, forming a correlation distribution map with timestamp as the horizontal axis and cosine similarity value as the vertical axis. The third step is to traverse all time sampling points in the similarity curve, identify and extract the local maximum value in the curve as candidate feature peaks; in view of the narrow power consumption of the lightweight algorithm, peak alignment is performed within a preset time window to compensate for the time axis offset caused by sampling clock jitter or hardware delay. The fourth step is to compare the characteristic peaks of the same guessed key in different time periods, select the global maximum value in the entire curve as the final relevance score of the guessed key, and record the time point index corresponding to the maximum value to ensure that the evaluation benchmarks between different key guesses are logically aligned in physical time.
9. The SPECK cryptographic side-channel attack method according to claim 1, characterized in that, The steps in step 4, which involve determining the subkey based on the correlation coefficient and using guessing entropy and success rate as core metrics, are as follows: The first step is to select the maximum similarity value as the evaluation index of the candidate key from the time-sampled points of the similarity between the theoretical leakage vector and the actual power consumption vector of each candidate key; after traversing all candidate keys, select the candidate key with the maximum evaluation index as the current subkey. The second step is to sort all candidate keys according to their corresponding similarity evaluation index and determine the position of the current subkey in the sorting result; this position is used as the guessing entropy value to measure the uncertainty of key guessing during the attack process.
10. The SPECK cryptographic side-channel attack method according to claim 1, characterized in that, The construction of the multi-parameter quantitative evaluation system mentioned in step 4 refers to counting the number of times the correct key was successfully recovered in each independent side-channel attack, and using the ratio of this number to the total number of side-channel attacks as the success rate indicator to reflect the stability and reliability of the attack method.