Construction method and device of neural network differential discriminator based on multi-scale convolution
By constructing a neural network differential distinguisher through a multi-scale convolution optimization scheme, the universality and generalization problems of existing differential distinguishers in lightweight symmetric cryptanalysis are solved. This achieves high-accuracy distinguishing and key recovery, improves the security assessment capability of symmetric cryptographic algorithms, and is particularly suitable for resource-constrained IoT and mobile communication environments.
Patent Information
- Application Number
- CN202510348795.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2025-03-24
- Publication Date
- 2025-11-21
- Estimated Expiration
- 2045-03-24
AI Technical Summary
Existing differential distinguisher construction methods lack universality and generalization in lightweight symmetric cryptanalysis, and cannot effectively evaluate and improve the security of encryption algorithms. Especially in resource-constrained environments, existing methods cannot effectively carry out key recovery attacks.
A neural network differential discriminator is constructed using a multi-scale convolution optimization scheme. By adjusting the structure of the residual neural network and combining the pyramid convolution idea, the residual tower and the number of convolutional layers are optimized to construct a differential discriminator suitable for ciphertext structures, achieving high-accuracy discrimination and key recovery for lightweight symmetric encryption algorithms.
It achieves high accuracy in distinguishing lightweight symmetric encryption algorithms with 5-7 rounds and successfully conducts key recovery attacks on symmetric cryptographic algorithms with 11 rounds, significantly improving the accuracy of ciphertext distinction and the success rate of key recovery. It provides new improvement methods and tools for evaluating the security of encryption algorithms.
Smart Images

Figure CN120146111B_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application relates to the technical field of cryptography combined with artificial intelligence, and more particularly, to a construction method and device of a neural network differential discriminator based on multi-scale convolution. BACKGROUND
[0002] Nowadays, with the popularity of big data systems, Internet of Things systems and various intelligent application systems, cryptography is developing rapidly and also faces new challenges, such as the emergence of quantum computers, which has given rise to a large number of studies on quantum and post-quantum cryptography. Researchers need to develop new cryptographic algorithms and protocols, such as lattice-based and code-based cryptography. In this era of Internet of Everything, a large number of Internet of Things devices are being put into use, but their own storage and computing capabilities are limited and cannot use conventional cryptographic algorithms. Therefore, simple, efficient and suitable for resource-constrained environments block cipher algorithms have been proposed and widely concerned and studied. The design and analysis of block ciphers are two complementary research fields. On the one hand, using existing cryptographic analysis methods, cryptographic designers hope to design cryptographic algorithms that can resist all known attacks. On the other hand, cryptographic analysts also hope to find some security flaws in existing cryptographic algorithms and attack them. These two complementary aspects are constantly advancing the development of block cipher theory.
[0003] In cryptography, the terms "analysis" and "attack" are equivalent in meaning. Cryptographic analysis is also the study of the security strength of a cipher when it is broken using different attack methods. It is divided into practical security and theoretical security. Evaluating the practical security of an encryption algorithm is done by considering the actual amount of computation required to break the cipher, without considering the attacker's computing power and computation time. This evaluation usually involves key recovery attacks, which use known information (including partial plaintext and its corresponding ciphertext) to recover the encryption key or part of the key bits of the cryptographic algorithm. Generally, the security analysis of block ciphers mainly focuses on key recovery attacks. In cryptographic analysis, the famous Kerckhoff assumption is usually followed, which states that "the security of a cryptographic system should be based on the secrecy of the key, not on the secrecy of the algorithm details." Under the Kerckhoff assumption, the analysis of the security of a cipher is essentially an evaluation of the secrecy of the key, not of the encryption algorithm itself. Therefore, the security analysis of an encryption algorithm mainly focuses on the secrecy of the key, not on the specific details of the encryption algorithm. This analysis method believes that even if an attacker understands the working principle of the encryption algorithm, as long as the key is secret, the encryption system can still remain secure. Therefore, the focus of cryptographic analysis is to determine the strength and secrecy of the encryption key.
[0004] For symmetric cryptographic algorithms, there are various cryptanalysis methods, the most important of which include differential cryptanalysis, linear cryptanalysis, integral attack, and related attack variants. Analysis and attack on lightweight symmetric cryptography can generally be divided into two stages: distinguisher construction and key recovery. In the distinguisher construction stage, the attacker looks for non-random characteristics in the cryptographic algorithm, such as linear correlation of internal state or abnormal distribution of output difference given a specific input difference. The key recovery stage targets the round function before and after the constructed distinguisher, and uses these non-random characteristics to (partially) recover the key bits. In essence, the attacker makes guesses about the key information and checks whether there are non-random characteristics after encrypting or decrypting several rounds of functions. If the probability distribution of the statistical data meets the expected value, it is considered that the guessed key may be correct. Optimizing key recovery attacks is an important aspect of cryptanalysis. Similarly, analysis of symmetric cryptography is carried out by extracting and applying non-random statistical characteristics in the cryptographic algorithm. In the early 1990s, Eli Biham and Adi Shamir proposed a differential analysis method at the American Cryptology Association. Differential cryptanalysis belongs to the chosen plaintext attack method, which separates block ciphers from random permutations by the probability propagation characteristics of specific plaintext difference values in the encryption process, and then conducts a key recovery attack. Let the plaintext input pair be , then The difference value is defined as , the intermediate ciphertext after the first round of iteration is , the difference value is , and after n rounds of iteration, a difference value sequence is obtained, which is called an n-round differential path of the block cipher, and the differential characteristic represents the differential propagation characteristics in the encryption process.
[0005] In the prior art, CN118114229A discloses a symmetric cipher differential distinguisher based on a residual neural network, including an initial convolution module, a residual module, a prediction module, etc., which mainly modifies the prediction module, and the modification method is a simple hierarchical superposition. CN119519940A discloses a design method of a symmetric cipher differential distinguisher based on deep learning, which establishes a preliminary symmetric cipher differential distinguisher based on an input module, an initial convolution module, a residual module and a prediction module, optimizes the preliminary symmetric cipher differential distinguisher, and generates several different residual structure distinguishers. It improves the residual module and the activation function, and combines different numbers of one-dimensional convolution layers with batch normalization and Hardswish activation function in the residual module. However, the existing method only makes specific improvements for the current task, and cannot have universality and generalization, and does not consider the characteristics of the ciphertext structure itself, so that the constructed differential distinguisher still has poor effect. SUMMARY
[0006] The application provides a differential discriminator structure construction optimization method based on a multi-scale convolution optimization scheme, and uses a differential discriminator constructed based on the method to perform related password cracking.
[0007] To achieve the above purpose, the first aspect of the application provides a construction method of a neural network differential discriminator based on multi-scale convolution, comprising:
[0008] The neural network differential discriminator suitable for the structure of the ciphertext is preliminarily constructed by adjusting the residual neural network, wherein the preliminarily constructed neural network differential discriminator comprises an input module, an initial convolution module, a residual module and a prediction module, the input module is used to receive input data from the ciphertext pair, the initial convolution module is used to extract features of the input data of the ciphertext pair, the residual module is used to extract deep features of the input data of the ciphertext pair, and the prediction module is used to map the input features to output labels to obtain a final result.
[0009] The number of residual towers in the neural network differential discriminator and the number of convolution layers in the residual towers are adjusted to preliminarily optimize the neural network differential discriminator, and the size composition of the convolution kernel of the neural network differential discriminator is adjusted in combination with the multi-scale convolution idea of the pyramid convolution to obtain an optimized neural network differential discriminator.
[0010] In one embodiment, the number of residual towers in the neural network differential discriminator and the number of convolution layers in the residual towers are adjusted to preliminarily optimize the neural network differential discriminator, and the size composition of the convolution kernel of the neural network differential discriminator is adjusted in combination with the multi-scale convolution idea of the pyramid convolution to obtain an optimized neural network differential discriminator, comprising:
[0011] Referring to the main network construction scheme of Res2Net, the residual module is modified, the feature tensor matrix obtained after the initial convolution module extracts features is input into the residual module, the feature tensor matrix is copied multiple times and input into the neural network as learning data, the way of learning and then splicing again after the channel dimension of the feature tensor is segmented at the connection of the residual is modified into adding the result, the convolution kernel size of the convolution layer in a single residual tower and the initial convolution kernel size between the residual towers are increased one by one, and an optimized first neural network differential discriminator ND1 is constructed.
[0012] and / or Referring to the main network construction scheme of DenseNet, the residual module is modified, the learned features of each convolution layer are connected to the subsequent convolution layer as part of the input by using the residual structure, the feature learning and fusion are performed multiple times, four feature fusion layers are set to save and fuse the features between different convolution layers, the number of convolution layers in a single residual tower is increased, the size of the convolution kernel in the residual tower and between the residual towers is increased, and an optimized second neural network differential discriminator ND2 is constructed.
[0013] and / or Referring to the parallel convolution idea, the residual module is modified, five parallel double-layer convolution groups are used, the large residual tower has five double-layer convolution layers, and the small residual tower has two convolution layers. The size of the convolution kernel between the small residual tower and the large residual tower is increased one by one, and an optimized third neural network differential discriminator ND3 is constructed.
[0014] and / or Referring to the parallel convolution and feature multiple learning idea, the initial convolution module is modified, a single-layer convolution operation with a convolution kernel size of 1 is used for feature extraction, the single-layer convolution operation with a convolution kernel size of 1 is performed three times, and after the second and third convolution operations, 1-time and 2-time convolution operations with larger convolution kernels are performed again, respectively. Finally, the results of the three convolution operations are added to obtain the final feature matrix input into the residual module, and an optimized fourth neural network differential discriminator ND4 is constructed.
[0015] In an embodiment, the number of convolution layers in a single residual tower is increased from 2 to 5, the size of the convolution kernel in a single residual tower is increased one by one starting from 1 with an increment of 2, and the initial size of the convolution kernel between the residual towers is increased one by one with an increment of 2.
[0016] In an embodiment, the method further comprises:
[0017] Generating a ciphertext dataset, training the optimized neural network differential discriminator.
[0018] In an embodiment, generating a ciphertext dataset, training the optimized neural network differential discriminator, comprises:
[0019] Simulating the Speck symmetric encryption algorithm to generate a dataset for training and verification;
[0020] Setting the learning rate, Epoch, and Batch Size, using the Adam algorithm in Keras with default parameters to optimize the cross-entropy loss function and a small penalty of L2 weight regularization, using a cyclic learning rate for the learning rate, storing the obtained network at the end of each epoch, and evaluating the best network obtained according to the test set, which is not used for training;
[0021] The training of the neural network obtains a differential discriminator model file, and the differential discrimination accuracy of each neural network differential discriminator for 5-8 rounds is contained.
[0022] In an embodiment, the method further comprises: performing a key recovery attack based on the optimized neural network differential discriminator to crack the corresponding lightweight symmetric cipher.
[0023] In an embodiment, the key recovery attack based on the optimized neural network differential discriminator to crack the corresponding lightweight symmetric cipher comprises:
[0024] Based on the neutral bit, the Bayesian optimization and the UCB problem, a key recovery attack algorithm is created, and first, the obtained 6, 7 round ND2 neural network differential discriminator is used to perform a key recovery attack to expand the round to 11 rounds.
[0025] Using the existing ND2 neural network differential discriminator, the Speck encryption with the round reduced to 11 rounds is cracked.
[0026] Based on the same inventive concept, the second aspect of the present application provides a construction device of a neural network differential discriminator based on multi-scale convolution, comprising:
[0027] An initial construction module is configured to preliminarily construct a neural network differential discriminator suitable for a ciphertext structure by adjusting a residual neural network, wherein the preliminarily constructed neural network differential discriminator comprises an input module, an initial convolution module, a residual module and a prediction module, the input module is configured to receive input data from a ciphertext pair, the initial convolution module is configured to extract features of the input data from the ciphertext pair, the residual module is configured to extract deep features of the input data from the ciphertext pair, and the prediction module is configured to map the input features to output labels to obtain a final result.
[0028] An optimization module is configured to preliminarily optimize the neural network differential discriminator by adjusting the number of residual towers in the neural network differential discriminator and the number of convolution layers in the residual towers, and adjust the size of the convolution kernel of the neural network differential discriminator in combination with the multi-scale convolution idea of the pyramid convolution to obtain an optimized neural network differential discriminator.
[0029] Based on the same inventive concept, the third aspect of the present application provides a computer readable storage medium having a computer program stored thereon, the program being executed by a processor to implement the construction method of the neural network differential discriminator based on multi-scale convolution of the first aspect.
[0030] Based on the same inventive concept, the fourth aspect of the present application provides a computer device comprising a memory, a processor, and a computer program stored on the memory and executable on the processor, wherein the processor implements the construction method of the multi-scale convolution-based neural network differential discriminator according to the first aspect when executing the program.
[0031] Compared with the prior art, the present application has the following advantages and beneficial technical effects:
[0032] The present application proposes a differential discriminator structure construction optimization method based on a multi-scale convolution optimization scheme, which preliminarily constructs a neural network differential discriminator suitable for a ciphertext structure by adjusting a residual neural network, then preliminarily optimizes the neural network differential discriminator by adjusting the number of residual towers in the neural network differential discriminator and the number of convolution layers in the residual towers, and adjusts the convolution kernel size composition of the neural network differential discriminator in combination with the multi-scale convolution idea of pyramid convolution, to obtain an optimized neural network differential discriminator. The optimized differential discriminator realizes high-precision discrimination of a lightweight symmetric encryption algorithm reduced to 5-7 rounds.
[0033] On this basis, a key recovery attack is successfully carried out for an 11-round symmetric cipher algorithm, and the decryption target is achieved. This achievement effectively improves the analysis level of lightweight symmetric encryption algorithms and brings new improvement approaches and optimization ideas for cryptography research. In the field of information security, this technology can be used to evaluate and improve the security of encryption algorithms, and has extremely key application value in resource-limited environments such as the Internet of Things and mobile communication. BRIEF DESCRIPTION OF DRAWINGS
[0034] In order to more clearly illustrate the technical solutions in the embodiments of the present application or the prior art, the drawings needed to be used in the embodiments or prior art description will be briefly introduced as follows. Obviously, the drawings in the following description are some embodiments of the present application, and those skilled in the art can also obtain other drawings according to these drawings without creative labor.
[0035] Figure 1 The flowchart of the construction method of the multi-scale convolution-based neural network differential discriminator in the embodiments of the present application;
[0036] Figure 2 The framework diagram of the preliminary construction of the neural network differential discriminator in the embodiments of the present application;
[0037] Figure 3 The structure diagram of the residual module of the first optimized neural network differential discriminator ND1 in the embodiments of the present application;
[0038] Figure 4A structural schematic diagram of a residual module of an optimized second neural network differential discriminator ND2 in an embodiment of the present application;
[0039] Figure 5 A structural schematic diagram of a residual module of an optimized third neural network differential discriminator ND3 in an embodiment of the present application;
[0040] Figure 6 A structural schematic diagram of a residual module of an optimized fourth neural network differential discriminator ND4 in an embodiment of the present application. DETAILED DESCRIPTION
[0041] The present application discloses a method for constructing and optimizing a neural network differential discriminator using optimization schemes such as multi-scale convolution, to achieve high-accuracy decryption of reduced-round symmetric cipher algorithms. The method comprises the following steps: Step 1, proposing a generalizable scheme for the residual tower architecture of the optimized differential discriminator based on the multi-scale convolution idea. Step 2, constructing a neural network differential discriminator with stronger differential effect for the Speck encryption algorithm from 5-7 rounds based on the scheme in Step 1. Further, it also includes Step 3, generating a ciphertext dataset and training to obtain a differential discriminator model. Step 4, performing key recovery attacks based on the optimized neural network differential discriminator to decrypt the corresponding lightweight symmetric cipher.
[0042] The present application constructs and optimizes the neural network differential discriminator through schemes such as multi-scale convolution and residual tower reconstruction, achieving high-accuracy differentiation of lightweight symmetric encryption algorithms from 5-7 rounds. On this basis, further key recovery attacks are successfully implemented for 11 rounds of symmetric cipher algorithms, thus achieving the purpose of decryption. This achievement significantly improves the analysis capability of lightweight symmetric encryption algorithms, providing a new improvement method and optimization idea for cryptography research. In the field of information security, this technology can be used to evaluate and improve the security of encryption algorithms, especially in resource-constrained environments such as the Internet of Things and mobile communication, and has important application value. Through in-depth analysis of lightweight symmetric encryption algorithms, the present application provides a powerful tool for cryptography research and practice, promoting the technological progress in related fields.
[0043] To make the purpose, technical scheme and advantages of the embodiments of the present application clearer, the technical scheme of the embodiments of the present application will be described clearly and completely below with reference to the drawings in the embodiments of the present application. Obviously, the described embodiments are part of the embodiments of the present application, rather than all the embodiments. Based on the embodiments in the present application, all other embodiments obtained by those of ordinary skill in the art without creative labor fall within the scope of protection of the present application.
[0044] Embodiment One
[0045] The embodiment discloses a construction method of a neural network differential distinguisher based on multi-scale convolution, and the method comprises the following steps:
[0046] S1: a neural network differential distinguisher suitable for a ciphertext structure is initially constructed by adjusting a residual neural network, wherein the initially constructed neural network differential distinguisher comprises an input module, an initial convolution module, a residual module and a prediction module, the input module is used for receiving input data from a ciphertext pair, the initial convolution module is used for extracting features of the input data of the ciphertext pair, the residual module is used for extracting deep features of the input data of the ciphertext pair, and the prediction module is used for mapping the input features to an output label to obtain a final result;
[0047] S2: the number of residual towers in the neural network differential distinguisher and the number of convolution layers in the residual towers are adjusted, the neural network differential distinguisher is initially optimized, and the size of the convolution kernel of the neural network differential distinguisher is adjusted in combination with the multi-scale convolution idea of the pyramid convolution, so that an optimized neural network differential distinguisher is obtained.
[0048] The present application will satisfy the input difference And the last difference, i.e. The number of plaintext pairs is defined as The input difference is transformed into the output difference The probability is defined as shown in formula (1):
[0049] (1)
[0050] If the corresponding probability of all differential paths can be calculated, i.e. The differential distribution table (DDT) of the corresponding encryption algorithm is obtained, and the occurrence probability is much higher than The differential path of the differential is called a high-probability differential path, and finding the high-probability differential path with the highest probability is a precondition for differential analysis, and the subsequent steps are as follows:
[0051] (1) assuming that the length of the sub-key of the rth round to be recovered is L, a counter is set for each key to be guessed, which is used as a score of the candidate key;
[0052] (2) a random plaintext is uniformly selected, and is subjected to exclusive OR operation with the value of in the high-probability differential path to obtain a plaintext pair , and after encryption of r+1 rounds, a ciphertext pair is obtained;
[0053] (3) using a differential distinguisher to filter the ciphertext pairs, then using a random key to decrypt the ciphertext pairs (C0, C1) ), if the decrypted ciphertext pair differential value is , then the counter value is incremented by one, and the key with the largest resulting value is considered to be the correct key.
[0054] As a common cryptanalysis technique, differential cryptanalysis is widely used in the analysis of cryptographic algorithms due to its efficiency, universality, and ability to reveal the internal characteristics of cryptographic algorithms. From the basic DES encryption algorithm to Blowfish, Speck, LBlock, differential analysis has become one of the security indicators that must be considered in the design and analysis of symmetric cryptography.
[0055] Specifically, step S1 is an initial construction step, which preliminarily constructs a neural network differential distinguisher suitable for the structure of ciphertext by adjusting the residual neural network. The network structure is as follows: Figure 2 As can be seen, the neural network differential distinguisher is composed of an input module (Module1), an initial convolution module (Module2), a residual module (Module3), and a prediction module (Module4). The input module is used to receive data from the ciphertext pair input. A pair of (C0, C1) ciphertexts of Speck32 / 64 can be written as a sequence of four sixteen-bit words (w0, w1, w2, w3), which reflects the word-oriented structure of the ciphertext. In this network, wi is a row vector of a 4 × 16 matrix, and the input layer consists of 64 units arranged in a 4 × 16 array. In the initial convolution layer, a single-layer convolution operation with a kernel size of 1 is used to extract features of the ciphertext matrix in the input layer. The purpose of this step is to mimic the XOR operation in the cryptographic operation. Since the XOR operation cannot be performed in the neural network, this convolution layer learns the four-bit bits that are XORed with each other in the cryptographic operation and extracts features from them. A BN layer and a Relu activation function are added after the convolution layer. Next, the residual module is used to improve the feature extraction capability of the model. In this module, 10 residual towers composed of two layers of convolutional neural network layers are used to extract deeper features, i.e., each residual tower contains 2 one-dimensional convolutions with a kernel size of 3. BN layers and Relu activation functions are also added after the convolution layers to reduce information loss through residual connections. This module is used for main feature extraction. Finally, two fully connected layers with 64 neurons are added as the prediction module. This module maps the input features to the output labels, predicts the true pair and the random pair, and outputs the final result to obtain the accuracy. This method uses and improves the principle of the neural network differential distinguisher, which approximates to construct an approximate cryptographic differential distribution table (DDT) in the learning stage, and uses this information to directly classify the ciphertext pairs.
[0056] S2 is an optimization based on the model constructed in S1, including adjusting the number of residual towers in the neural network differential discriminator and the number of convolution layers in the residual tower, combining the multi-scale convolution idea of pyramid convolution, and adjusting the convolution kernel size composition of the neural network differential discriminator.
[0057] In an embodiment, the number of residual towers in the neural network differential discriminator and the number of convolution layers in the residual tower are adjusted, the neural network differential discriminator is preliminarily optimized, and the convolution kernel size composition of the neural network differential discriminator is adjusted in combination with the multi-scale convolution idea of pyramid convolution to obtain an optimized neural network differential discriminator, including:
[0058] Referring to the main network construction scheme of Res2Net, the residual module is modified, the feature tensor matrix obtained after the initial convolution module extracts features is input into the residual module, the feature tensor matrix is copied multiple times and input into the neural network as learning data, the channel dimension of the residual connection is segmented, learned, and then spliced again, and the convolution kernel size of the convolution layer in a single residual tower and the initial convolution kernel size between the residual towers are increased one by one to construct the first optimized neural network differential discriminator ND1.
[0059] And / or referring to the main network construction scheme of DenseNet, the residual module is modified, the learned features of each convolution layer are connected to the subsequent convolution layer by a residual structure as part of the input, and the features are learned and fused multiple times, wherein four feature fusion layers are set to save and fuse the features between different convolution layers, the number of convolution layers in a single residual tower is increased, and the convolution kernel size between the residual towers is increased to construct the second optimized neural network differential discriminator ND2.
[0060] And / or referring to and using the parallel convolution idea, the residual module is modified, five parallel double-layer convolution groups are used, the large residual tower has five double-layer convolution layers, the small residual tower has two convolution layers, and the convolution kernel size between the small residual tower and the large residual tower is increased one by one to construct the third optimized neural network differential discriminator ND3.
[0061] And / or referring to and using the parallel convolution and feature multiple learning idea, the initial convolution module is modified, a single-layer convolution operation with a convolution kernel size of 1 is used for feature extraction, the single-layer convolution operation with a convolution kernel size of 1 is performed three times, and after the second and third convolution operations, 1-time and 2-time larger convolution operations are performed again, respectively. Finally, the results of the three convolution operations are added to obtain the final feature matrix input into the residual module to construct the fourth optimized neural network differential discriminator ND4.
[0062] Specifically, referring to the main network construction scheme of Res2Net, the first optimized differential discriminator ND1 is constructed. The differential discriminator has multi-scale feature representation capability, which effectively improves the discrimination performance. Specifically: after the initial convolution module extracts the features, the 16x32 feature tensor matrix is input into the residual module, the feature tensor matrix is copied multiple times and input into the neural network as learning data, and the scheme of splicing after modifying the split channel in Res2Net is modified to add the results suitable for the structure of the ciphertext, and the first optimized differential discriminator ND1 is constructed, and the specific structure of the modified residual module is as shown in Figure 3
[0063] Since Res2Net is an image neural network itself, the channel dimension of the feature tensor is split, learned, and then spliced in the residual block. In order to make the neural network structure more suitable for learning the structure of the ciphertext, the results are directly added at the connection of the residual, thereby maintaining the integrity of the ciphertext structure. ND1 first extracts the features after the initial convolution module, and then inputs the 16x32 feature tensor matrix into the residual module. The embodiment changes the behavior of splitting the matrix in the traditional Res2net network to save the integrity of the ciphertext structure. The 5 convolution layers in the convolution module are designed like a ladder, and the features learned by the front convolution layer and the subsequent copied ciphertext data are used as the input data of the subsequent convolution layer. The convolution kernel size of the convolution layer in a single residual tower and the initial convolution kernel size between the residual towers are both increased by 2.
[0064] Referring to the main network construction scheme of DenseNet, the second optimized differential discriminator ND2 is constructed. The differential discriminator has similar ciphertext discrimination ability to ND1. The specific structure of the modified residual module is as shown in Figure 4 , which is the best discriminator that balances accuracy, training loss, and time. The innovative idea of the ND2 residual tower module is similar to DenseNet, that is, the features learned by each convolution layer are connected to the subsequent convolution layer in a residual structure as part of the input, and the features are learned and fused multiple times, wherein 4 feature fusion layers (i.e. the circular plus part in Figure 4 ) are set to save and fuse features between different convolution layers. In addition, the number of convolution layers in a single residual tower is increased from 2 to 5, and the convolution kernel size increasing relationship between the residual towers is also applied.
[0065] Referring to and applying the concept of parallel convolution, a third optimized differential discriminator, ND3, was constructed. This differential discriminator has similar ciphertext discrimination capabilities to ND1. The specific structure of its modified residual module is as follows: Figure 5 As shown. The residual module of the ND3 differential discriminator consists of 5 parallel double-layer convolutional groups, with a small residual tower ( Figure 5 The structure formed by two convolutional layers in each vertical row contains two convolutional layers, but the entire residual tower contains five smaller residual towers, which are smaller than the large residual towers ( Figure 5 The kernel size between the residual modules shown in the diagram still increases by 2 sequentially. This grouped convolution operation makes the convolution operations in the network more flexible and increases the expressive power of the model. By increasing the number of groups of convolutions, the network width can be increased, thereby increasing the capacity and representational power of the model.
[0066] Similarly, referencing and applying the ideas of parallel convolution and multiple feature learning, a fourth optimized differential discriminator, ND4, was constructed. This differential discriminator is slightly inferior to ND1-ND3 in terms of ciphertext discrimination capability, but its training loss and time are significantly reduced, making it a lightweight differential discriminator. The specific structure of its modified initial convolutional module is as follows: Figure 6 As shown. For the initial convolutional module, ND4 uses a single-layer convolutional operation with a kernel size of 1 to extract features, which more closely resembles the bitwise operation pattern in encryption algorithms, obtaining more information about the correlation between bits that are XORed. This single-layer convolutional operation with a kernel size of 1 is performed three times (i.e.,...). Figure 6 The first three convolution operations are performed, followed by one and two more convolution operations with larger kernels after the second and third convolutions, respectively. Finally, the results of the three convolutions (i.e., the first convolution with one convolution operation, the second convolution with two convolutions, and the third convolution with three convolutions) are summed to obtain the final feature matrix and input to the residual module.
[0067] Although the document 1-CN118114229A in the prior art discloses a symmetric cipher differential discriminator based on a residual neural network, including an input module, an initial convolution module, a residual module and a prediction module, it mainly improves the prediction module, and the improvement scheme is a simple hierarchical superposition. Specifically, the original prediction module is composed of two layers of MLP neural network, each layer uses a relu activation function, and the final output unit is 1, using a sigmoid output activation function. The improvement in document 1 is to change the 2-layer MLP to 14 layers, and the number of neurons in each layer is 512, 448, 384, 320, 256, 192, 128, 96, 64, 32, 16, 8, 4, respectively, each layer uses a gelu activation function, and then the output unit is increased to two, using softmax as the output activation function. As can be seen, the main improvement of document 1 is to simply stack the mlp hierarchy, and the other improvements are simple hyperparameter adjustments. This improvement scheme is only for this network structure and the cipher algorithm, and has no high universality and generalization, and is only suitable for this scheme.
[0068] Document 2-CN119519940A discloses a design method of a symmetric cipher differential discriminator based on deep learning, which improves the scheme by adding a simple attention mechanism inside the residual tower. This is different from the multi-scale convolution and feature multiple learning innovative ideas of the present application. In addition, document 2 only modifies the residual module, while the improvement of the present application is for the residual module and the initial convolution module, which is more comprehensive in comparison. Like the shortcomings of document 1, this improvement of document 2 has no high universality, while the present application is not only four excellent network structures, but also an improvement scheme that can be widely used in symmetric cipher differentiation experiments. The four network structures are proposed to prove the advantages of this improvement scheme. In addition, another defect of document 2 is that the differentiation accuracy is low, which is obviously lower than the accuracy in the present application, with only 93.04% for 5 rounds. Overall, compared with the prior art, in the differentiation experiment and key recovery attack of Speck32 / 64, the various discriminators proposed in the present application have much higher differentiation accuracy and key cracking success rate than document 2, and also have certain advantages compared with document 1. The present application proposes a highly generalized neural network differential discriminator construction scheme, which has great reference value for research in the field, while documents 1 and 2 are only simple neural network structure optimization.
[0069] In one embodiment, the number of convolution layers in a single residual tower is increased from 2 to 5, the convolution kernel size in a single residual tower starts from 1 and increases by 2 each time, and the initial size of the convolution kernel between the residual towers increases by 2 each time.
[0070] In combination with the pyramid convolution, the Speck ciphertexts of 5 rounds are used to test the advantages and disadvantages of different construction schemes, and the best convolution construction scheme is determined. The comparison table is shown in Table 1.
[0071]
[0072] Table 1
[0073] In an embodiment, the method further comprises:
[0074] Generate a ciphertext dataset, and train the optimized neural network differential discriminator (see Table 2 for the discrimination accuracy and improvement of each discriminator for the Speck encryption algorithm).
[0075]
[0076] Table 2
[0077] The training process specifically includes:
[0078] Simulate the Speck symmetric cipher algorithm to generate a dataset for training and verification;
[0079] Set the learning rate, Epoch, and Batch Size, and use the Adam algorithm in Keras with default parameters to optimize the cross-entropy loss function and L2 weight regularization with a small penalty. The learning rate uses a cyclic learning rate, where the obtained network is stored at the end of each epoch, and the best network is evaluated according to the test set, which is not used for training.
[0080] Train the neural network to obtain a differential discriminator model file, which includes the discrimination accuracy of each neural network differential discriminator for 5-8 rounds.
[0081] In the specific implementation process, the training set is 100w ciphertext data, with true and random pairs each accounting for half, and the test set is 10w ciphertext data.
[0082] The network is trained for 200 epochs. The batch size is set to 5000. The Adam algorithm in Keras with default parameters is used to optimize the cross-entropy loss function and L2 weight regularization (regularization parameter) with a small penalty. The learning rate uses a cyclic learning rate, as shown in formula 1, where. The obtained network is stored at the end of each epoch, and the best network is evaluated according to the test set, which is not used for training.
[0083] (2)
[0084] = , = , n = 9, The current learning rate, here the parameter has no practical significance, because it is only to achieve the cycle learning rate of every 10 epochs.
[0085] The differential discriminator model file obtained by training the neural network includes the differential accuracy of each discriminator for 5-8 rounds, which is an important indicator for evaluating the discriminator, and the weight file (h5 file) of the discriminator.
[0086] In an embodiment, the method further comprises: performing a key recovery attack based on the optimized neural network differential discriminator to crack the corresponding lightweight symmetric cipher.
[0087] See Figure 1 , the flowchart of the construction method of the neural network differential discriminator based on multi-scale convolution in the embodiment of the application.
[0088] The steps of the key recovery attack specifically include:
[0089] Based on the neutral bit, Bayesian optimization and UCB problem, a key recovery attack algorithm is created, first using the obtained 6, 7 round ND2 neural network differential discriminator to expand the recovery round to 11 rounds.
[0090] Using the existing ND2 neural network differential discriminator, the Speck encryption with reduced rounds to 11 rounds is cracked.
[0091] In the specific implementation process, based on the neutral bit, Bayesian optimization and UCB problem, a key recovery attack algorithm is created. First, use the obtained 6, 7 round ND2 differential discriminator to expand the recovery round to 11 rounds. The specific steps are as follows:
[0092] (1) Set two rounds of preset differential (0x211, 0xa04)→(0x40, 0), that is, select the plaintext pair with differential (0x211, 0xa04), and get the high probability differential (0x40, 0) after two rounds of encryption, and the probability is , the 7 rounds are expanded to 9 rounds;
[0093] (2) According to the property of Speck encryption that can be expanded by one round without consumption, the 9 round differential discriminator can be expanded to 10 rounds without consumption;
[0094] (3) In the key recovery attack, the key is needed to decrypt the N round ciphertext pair, and after obtaining the N-1 round ciphertext, the differential discriminator is used for judgment, so that one more round can be expanded after 10 rounds, so as to reach 11 rounds.
[0095] The key recovery attack algorithm of 11 round Speck encryption algorithm is as follows:
[0096] The number of recovery attacks is set to 100, and 100 ciphertext structures of 11 rounds are generated in each recovery attack; each ciphertext structure is obtained by using neutral bit flipping, and a single ciphertext pair can be obtained by flipping 6 bits to obtain a ciphertext structure containing 64 ciphertext pairs. 100 ciphertext structures are generated;
[0097] Search the ciphertext structure, set the maximum iteration number to 500, and use the UCB algorithm to select a ciphertext structure with the highest current priority in each iteration. The first ciphertext structure is selected.
[0098] Decrypt and score the selected ciphertext structure using the Bayesian optimization algorithm, and iterate five times. In each Bayesian optimization iteration, the selected 32 candidate keys are used to decrypt all ciphertext pairs, and the first key is randomly selected. The selected key is used for decryption, and the decrypted ciphertext is scored by the discriminator. The score of the key and the average score of the discriminator are calculated by formula (3);
[0099] (3)
[0100] represent the key score, is the output signal of the i-th input sample given by the neural discriminator, k is the block size, which is set to 1 here, and N is the total number of ciphertext pairs;
[0101] The Euclidean distance scores of each candidate key with a difference of The first 32 keys with the smallest distance are used as the keys for the next iteration. In this way, only 160 candidate final round subkeys need to be tried for each ciphertext structure, and the used keys and corresponding key scores are output.
[0102] For candidate keys with a score greater than = 10, the next step is performed. The Bayesian optimization algorithm is used again to recommend 160 10-round candidate keys, and the corresponding scores are calculated. If the score is greater than = 10, then the two selected keys are output as the key guess.
[0103] Calculate the bit difference between the guessed key and the true key to determine whether the key recovery is successful.
[0104] Using the existing ND2 neural network differential discriminator, the Speck encryption from the reduced round to the 11th round is decrypted. In 1000 key recovery attacks, 160 ciphertext structures are used. The number of successful key recovery attacks of the differential discriminator reaches 618 times, and the success rate is about 61.8%, which is improved by 9.7% compared with the current mainstream algorithm, and a significant effect is achieved.
[0105] Embodiment two
[0106] Based on the same inventive concept, the embodiment discloses a construction device of a neural network differential discriminator based on multi-scale convolution, comprising:
[0107] An initial construction module is configured to preliminarily construct a neural network differential discriminator suitable for a ciphertext structure by adjusting a residual neural network, wherein the preliminarily constructed neural network differential discriminator comprises an input module, an initial convolution module, a residual module and a prediction module, the input module is configured to receive input data from a ciphertext pair, the initial convolution module is configured to extract features of the input data from the ciphertext pair, the residual module is configured to extract deep features of the input data from the ciphertext pair, and the prediction module is configured to map the input features to output labels to obtain a final result.
[0108] An optimization module is configured to adjust the number of residual towers in the neural network differential discriminator and the number of convolution layers in the residual towers, preliminarily optimize the neural network differential discriminator, and adjust the size of the convolution kernel of the neural network differential discriminator in combination with the multi-scale convolution idea of the pyramid convolution, to obtain an optimized neural network differential discriminator.
[0109] Since the system introduced in the embodiment two of the present application is the system used in the construction method of the neural network differential discriminator based on multi-scale convolution in the embodiment one of the present application, the specific structure and deformation of the system can be understood by those skilled in the art based on the method introduced in the embodiment one of the present application, and thus will not be described here. Any system used in the method in the embodiment one of the present application belongs to the scope of the present application.
[0110] Embodiment three
[0111] Based on the same inventive concept, the present application further provides a computer readable storage medium having a computer program stored thereon, which is executed by a processor to implement the method of the embodiment one.
[0112] Since the computer readable storage medium introduced in the embodiment three of the present application is the computer readable storage medium used in the construction method of the neural network differential discriminator based on multi-scale convolution in the embodiment one of the present application, the specific structure and deformation of the computer readable storage medium can be understood by those skilled in the art based on the method introduced in the embodiment one of the present application, and thus will not be described here. Any computer readable storage medium used in the method of the embodiment one of the present application belongs to the scope of the present application.
[0113] Embodiment four
[0114] The application further provides a computer device, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor implements the method of the embodiment one when executing the program.
[0115] Since the computer device introduced in the embodiment four of the application is the computer device used for implementing the construction method of the neural network difference partitioner based on multi-scale convolution in the embodiment one of the application, the specific structure and deformation of the computer device can be understood by those skilled in the art based on the method introduced in the embodiment one of the application, and thus will not be described here again. Any computer device used for the method of the embodiment one of the application belongs to the scope of the application.
[0116] Those skilled in the art will understand that the embodiments of the application can be provided as a method, a system, or a computer program product. Therefore, the application can adopt a completely hardware embodiment, a completely software embodiment, or an embodiment combining software and hardware aspects. Moreover, the application can adopt a computer program product implemented on one or more computer usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) containing computer usable program codes.
[0117] The application is described with reference to flowcharts and / or block diagrams of the method, device (system), and computer program product according to the embodiments of the application. It should be understood that each flow and / or block in the flowcharts and / or block diagrams, and the combination of the flows and / or blocks in the flowcharts and / or block diagrams can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing devices to produce a machine, so that the instructions executed by the processor of the computer or other programmable data processing devices produce a device for implementing the functions specified in the flowcharts and / or block diagrams. Figure 1 The function of one flow or multiple flows and / or blocks Figure 1 The device for implementing the function specified in one block or multiple blocks.
[0118] Although the preferred embodiments of the application have been described, those skilled in the art can make additional changes and modifications to the embodiments once they know the basic inventive concept. Therefore, the appended claims are intended to be interpreted as including all the preferred embodiments and all the changes and modifications falling within the scope of the application. Obviously, those skilled in the art can make various modifications and variations to the embodiments of the application without departing from the spirit and scope of the embodiments of the application. Thus, if these modifications and variations of the embodiments of the application fall within the scope of the claims of the application and their equivalent technologies, the application also intends to include these modifications and variations.
Claims
1. A method for constructing a neural network difference discriminator based on multi-scale convolution, characterized in that, include: A preliminary neural network differential discriminator suitable for ciphertext structures is constructed by adjusting the residual neural network. The preliminary neural network differential discriminator includes an input module, an initial convolution module, a residual module, and a prediction module. The input module is used to receive ciphertext pairs as input data, the initial convolution module is used to extract features of the ciphertext pairs as input data, the residual module is used to extract deep features of the ciphertext pairs as input data, and the prediction module is used to map the input features to the output labels to obtain the final result. The number of residual towers and the number of convolutional layers within the residual towers are adjusted to perform preliminary optimization of the neural network differential discriminator. Then, combining the multi-scale convolution concept of pyramid convolution, the kernel size composition of the neural network differential discriminator is adjusted to obtain the optimized neural network differential discriminator. Specifically, this includes: Referring to the main network construction scheme of Res2Net, the residual module is modified. After feature extraction in the initial convolution module, the obtained feature tensor matrix is input into the residual module. Multiple copies of the feature tensor matrix are copied and used as learning data input into the neural network. The method of segmenting the channel dimension of the feature tensor at the connection of the residual and then learning and concatenating them is changed to adding the results. The size of the convolution kernel of the convolutional layer in a single residual tower and the size of the initial convolution kernel between residual towers are increased sequentially to construct the optimized first neural network differential discriminator ND1. And / or referencing the main network construction scheme of DenseNet, modifications were made to the residual module. The features learned by each convolutional layer were connected to subsequent convolutional layers using residual structures as part of the input. Features were learned and fused multiple times. Four feature fusion layers were set up to preserve and fuse features between different convolutional layers. The number of convolutional layers in a single residual tower was increased, and the size of the convolutional kernels within and between residual towers was increased to construct the optimized second neural network differential discriminator ND2. And / or referencing and applying the idea of parallel convolution, the residual module is modified to consist of 5 parallel double-layer convolution groups, with a large residual tower having 5 small residual towers, and each small residual tower having two convolutional layers. The large residual tower is the residual module, and the size of the convolution kernel between the small residual towers and the large residual tower increases sequentially, thus constructing the optimized third neural network differential discriminator ND3. And / or referencing and applying the ideas of parallel convolution and feature learning multiple times, the initial convolution module is modified, and a single-layer convolution operation with a kernel size of 1 is used for feature extraction. The single-layer convolution operation with a kernel size of 1 is performed three times, and after the second and third convolution operations, one and two more convolution operations with larger kernels are performed respectively. Finally, the results of the three convolutions are summed to obtain the final feature matrix, which is input into the residual module to construct the optimized fourth neural network differential discriminator ND4.
2. The method for constructing a neural network difference discriminator based on multi-scale convolution as described in claim 1, characterized in that, The number of convolutional layers in a single residual tower is increased from 2 to 5. The kernel size in a single residual tower starts from 1 and increases incrementally by 2. The initial kernel size between residual towers also increases incrementally by 2.
3. The method for constructing a neural network difference discriminator based on multi-scale convolution as described in claim 1, characterized in that, The method further includes: Generate a encrypted dataset and train the optimized neural network differential discriminator.
4. The method for constructing a neural network difference discriminator based on multi-scale convolution as described in claim 3, characterized in that, Generate a encrypted dataset and train the optimized neural network differential discriminator, including: Simulate the Speck symmetric cryptography algorithm to generate training and testing datasets; Set the learning rate, epoch, and batch size. Use the Adam algorithm with default parameters in Keras to optimize the cross-entropy loss function and the penalty of L2 weight regularization. Use a cyclic learning rate, where the obtained network is stored at the end of each epoch, and the best network is evaluated based on the test set, which was not used for training. Train the neural network to obtain the differential discriminator model file, which contains the discrimination accuracy of each neural network differential discriminator for 5-8 rounds.
5. The method for constructing a neural network difference discriminator based on multi-scale convolution as described in claim 1, characterized in that, The method further includes: performing a key recovery attack based on an optimized neural network differential distinguisher to decipher the corresponding lightweight symmetric cipher.
6. The method for constructing a neural network difference discriminator based on multi-scale convolution as described in claim 5, characterized in that, A key recovery attack based on an optimized neural network differential distinguisher is used to break the corresponding lightweight symmetric cryptography, including: Based on neutral bit, Bayesian optimization and UCB problem, a key recovery attack algorithm is created. First, an ND2 neural network differential divider with 6 or 7 rounds is used to extend the recovery rounds to 11 rounds. Using the existing ND2 neural network differential discriminator, we decipher Speck encryption reduced to 11 rounds.
7. A device for constructing a neural network difference discriminator based on multi-scale convolution, characterized in that, include: The initial construction module is used to initially construct a neural network differential discriminator suitable for ciphertext structures by adjusting the residual neural network. The initially constructed neural network differential discriminator includes an input module, an initial convolution module, a residual module, and a prediction module. The input module is used to receive ciphertext pairs as input data, the initial convolution module is used to extract features of the ciphertext pairs as input data, the residual module is used to extract deep features of the ciphertext pairs as input data, and the prediction module is used to map the input features to the output labels to obtain the final result. The optimization module is used to adjust the number of residual towers and the number of convolutional layers in the residual towers of the neural network differential divider, to perform preliminary optimization of the neural network differential divider. It also combines the multi-scale convolution idea of pyramid convolution to adjust the kernel size composition of the neural network differential divider, thus obtaining the optimized neural network differential divider. Specifically, the optimization module is used for: Referring to the main network construction scheme of Res2Net, the residual module is modified. After feature extraction in the initial convolution module, the obtained feature tensor matrix is input into the residual module. Multiple copies of the feature tensor matrix are copied and used as learning data input into the neural network. The method of segmenting the channel dimension of the feature tensor at the connection of the residual and then learning and concatenating them is changed to adding the results. The size of the convolution kernel of the convolutional layer in a single residual tower and the size of the initial convolution kernel between residual towers are increased sequentially to construct the optimized first neural network differential discriminator ND1. And / or referencing the main network construction scheme of DenseNet, modifications were made to the residual module. The features learned by each convolutional layer were connected to subsequent convolutional layers using residual structures as part of the input. Features were learned and fused multiple times. Four feature fusion layers were set up to preserve and fuse features between different convolutional layers. The number of convolutional layers in a single residual tower was increased, and the size of the convolutional kernels within and between residual towers was increased to construct the optimized second neural network differential discriminator ND2. And / or referencing and applying the idea of parallel convolution, the residual module is modified to consist of 5 parallel double-layer convolution groups, with a large residual tower having 5 small residual towers, and each small residual tower having two convolutional layers. The large residual tower is the residual module, and the size of the convolution kernel between the small residual towers and the large residual tower increases sequentially, thus constructing the optimized third neural network differential discriminator ND3. And / or referencing and applying the ideas of parallel convolution and feature learning multiple times, the initial convolution module is modified, and a single-layer convolution operation with a kernel size of 1 is used for feature extraction. The single-layer convolution operation with a kernel size of 1 is performed three times, and after the second and third convolution operations, one and two more convolution operations with larger kernels are performed respectively. Finally, the results of the three convolutions are summed to obtain the final feature matrix, which is input into the residual module to construct the optimized fourth neural network differential discriminator ND4.
8. A computer-readable storage medium having a computer program stored thereon, characterized in that, When executed by a processor, the program implements the method for constructing a neural network differential discriminator based on multi-scale convolution as described in any one of claims 1 to 6.
9. A computer device, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that, When the processor executes the program, it implements the method for constructing a neural network differential discriminator based on multi-scale convolution as described in any one of claims 1 to 6.