A weighted integrated neural network key prediction method, device, medium and equipment

Through the weighted integrated neural network key prediction method, multiple key prediction models are trained using residual neural networks and weighted integration processing is performed, which solves the problem of high time complexity of key cracking in the prior art and realizes more efficient key prediction.

CN119363328BActive Publication Date: 2025-04-15INNER MONGOLIA UNIV OF TECH
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202411437106.8
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-10-15
Publication Date
2025-04-15
Estimated Expiration
2044-10-15

AI Technical Summary

Technical Problem

In the prior art, when cracking the keys of sequence ciphers, the time complexity is high, especially when the key bit length increases, the time required for cracking will increase dramatically.

Method used

The weighted integrated neural network key prediction method is adopted to obtain multiple sets of sample keys and initialization parameter vectors, generate a key stream, and train the residual neural network as training data to obtain multiple key prediction models. Then, the key stream of the cryptographic text data to be cracked is input to multiple key prediction models, a plurality of first bit prediction values ​​are obtained, and weighted integration processing is performed to obtain the first bit prediction result of the key.

Benefits of technology

It significantly reduces the time complexity of key prediction, makes attacks more efficient and can crack keys more quickly.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119363328B_ABST
    Figure CN119363328B_ABST
Patent Text Reader

Abstract

The present invention discloses a weighted integrated neural network key prediction method, device, medium and equipment, and relates to the cross-technical field of cryptanalysis and machine learning. Each set of preset number of sample keys and initialization parameter vectors are respectively input into the sequence key algorithm to obtain multiple sets of preset number of sample key streams; the first bit value of the sample key is used as the label of the corresponding sample key stream, and each set of preset number of sample key streams and corresponding labels are respectively used as training data to train the residual neural network to obtain multiple key prediction models; then the key stream of the ciphertext data to be cracked is respectively input into multiple key prediction models to obtain multiple first bit prediction values ​​of the key of the ciphertext data to be cracked; multiple first bit prediction values ​​are weighted integrated to obtain the key prediction result of the ciphertext data to be cracked. This method can reduce the time complexity of key prediction.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the cross-technical field of cryptographic analysis and machine learning, and in particular to a weighted integrated neural network key prediction method, device, medium and equipment. Background Art

[0002] In the field of cryptanalysis, machine learning technology was first applied to side-channel attacks (SCA). By intercepting the energy and electromagnetic waves leaked by hardware information during the encryption process, neural networks are used to learn encrypted information to predict possible encryption operations. However, this method only attacks from a practical perspective and has not risen to the level of theoretical analysis. Until a differential-neural distinguisher (ND) based on neural networks was proposed, it showed better performance than the pure differential distinguisher based on differential distribution tables (DDT). By using enough neutral bits, key recovery attacks are performed, and this method is successfully applied to Speck32 / 64. This method applies machine learning technology at the level of theoretical analysis and successfully achieves better attack results. However, this method is mainly used in block ciphers. At the theoretical analysis level, there is still no good method for machine learning-assisted cryptanalysis of sequence ciphers.

[0003] At present, stream ciphers usually use a key to generate a pseudo-random key stream, and then use the key stream to encrypt the plaintext data bit by bit; in the prior art, the key of the stream cipher is usually predicted by exhaustive method, but the bit length of the key is long, and the time complexity of the exhaustive method is exponential, which means that as the bit length increases, the time required for cracking will increase sharply. Therefore, the time complexity of predicting the key by exhaustive method is high. Summary of the invention

[0004] Based on this, it is necessary to provide a weighted integrated neural network key prediction method, device, medium and equipment to address the above technical problems. This method can reduce the time complexity of key prediction.

[0005] The present invention adopts the following technical solutions:

[0006] The present invention provides a weighted integrated neural network key prediction method, comprising:

[0007] Obtaining a plurality of sets of preset numbers of sample keys and initialization parameter vectors for a stream cipher algorithm;

[0008] Inputting each set of preset number of sample keys and initialization parameter vectors into the sequence key algorithm respectively to obtain multiple sets of preset number of sample key streams;

[0009] The first bit value of the sample key is used as the label of the corresponding sample key stream, and each group of preset number of sample key streams and corresponding labels are used as training data to train the residual neural network to obtain multiple key prediction models;

[0010] Inputting the key stream of the ciphertext data to be cracked into multiple key prediction models respectively to obtain multiple first bit prediction values ​​of the key of the ciphertext data to be cracked;

[0011] A plurality of first bit prediction values ​​are weighted and integrated to obtain a key prediction result of the ciphertext data to be cracked; the key prediction result includes the first bit value of the key of the ciphertext data to be cracked.

[0012] Preferably, each set of preset number of sample key streams and corresponding labels are used as training data to train the residual neural network to obtain multiple key prediction models, including:

[0013] For any set of preset number of sample key streams, the preset number of sample key streams and corresponding labels are used as training data, and the residual neural network is iteratively trained to obtain the loss function value of the residual neural network for each training;

[0014] The parameters of the residual neural network are updated according to the loss function value of the residual neural network in each training until the residual neural network converges and the key prediction model is determined.

[0015] Preferably, the residual neural network includes a feature extraction module, a residual block and a prediction module; iteratively training the residual neural network to obtain the loss function value of the residual neural network for each training includes:

[0016] For any training, the training data is input into the feature extraction module to obtain the features of the training data;

[0017] The features of the training data are input into the residual block, and the deep features of the training data are extracted through multi-layer convolution and skip connections;

[0018] Input the deep features of the training data into the prediction module to obtain the prediction results of the training data;

[0019] Compare the prediction results with the labels of the training data to determine the loss function value of the residual neural network.

[0020] Preferably, the prediction result is compared with the label of the training data to determine the loss function value of the residual neural network, including:

[0021] According to the prediction results and labels, the initial loss function value of the residual neural network is calculated through the binary cross entropy loss function corresponding to the binary classification task;

[0022] Perform weight decay on the initial loss function value to determine the loss function value.

[0023] Preferably, the parameters of the key prediction model are the parameters corresponding to the residual neural network with the highest prediction accuracy during the iterative training process.

[0024] Preferably, a plurality of first bit prediction values ​​are weighted and integrated to obtain a key prediction result of the ciphertext data to be cracked, including:

[0025] Obtain prediction accuracy rates of multiple key prediction models, and normalize the multiple prediction accuracy rates to obtain a normalized weight of each key prediction model;

[0026] According to the normalized weight of each key prediction model, multiple first bit prediction values ​​are weighted to obtain the prediction value of the ciphertext data to be cracked;

[0027] If the predicted value is greater than the preset threshold, the key prediction result is determined to be 1;

[0028] If the predicted value is less than or equal to the preset threshold, the key prediction result is determined to be 0.

[0029] The present invention provides a weighted integrated neural network key prediction device, comprising:

[0030] An acquisition module, used for acquiring a plurality of sets of preset number of sample keys and initialization parameter vectors for a stream cipher algorithm;

[0031] A sample generation module, used for inputting each set of preset number of sample keys and initialization parameter vectors into a sequence key algorithm to obtain multiple sets of preset number of sample key streams;

[0032] A training module, used to use the first bit value of the sample key as a label of the corresponding sample key stream, and use each group of preset number of sample key streams and corresponding labels as training data to train the residual neural network to obtain multiple key prediction models;

[0033] An output module, used for inputting the key streams of the ciphertext data to be cracked into the multiple key prediction models respectively, to obtain multiple first bit prediction values ​​of the key of the ciphertext data to be cracked;

[0034] The weighted integration module is used to perform weighted integration processing on the multiple first bit prediction values ​​to obtain the key prediction result of the ciphertext data to be cracked; the key prediction result includes the first bit value of the key of the ciphertext data to be cracked.

[0035] The present invention provides a computer-readable storage medium, which stores a computer program. When the computer program is executed by a processor, the weighted integrated neural network key prediction method is implemented.

[0036] The present invention provides a computer device, including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor implements the above-mentioned weighted integrated neural network key prediction method when executing the program.

[0037] At least one of the above technical solutions adopted by the present invention can achieve the following beneficial effects:

[0038] The present invention adopts the initialization parameter vector of the sequence cipher algorithm and multiple groups of preset number of sample keys to generate a key stream, and uses the key stream and the corresponding label as training data, which is equivalent to the present invention adopting the core concept of plaintext attack and initial vectorization attack, and using the key stream that can be intercepted during data encryption transmission and the fixed initialization parameter vector for model training, and both data generation and model training belong to the preprocessing process, and do not occupy the actual supply time consumption. When performing a data attack, the key stream of the intercepted ciphertext data to be cracked can be directly predicted by multiple trained key prediction models to predict multiple first bit prediction values ​​of the key of the ciphertext data to be cracked, and then the multiple first bit prediction values ​​are weighted and integrated to finally obtain the first bit value of the key of the ciphertext data to be cracked; in this way, compared with the prior art that multiple bits of the key need to be predicted by exhaustive method, the present invention predicts the first bit value of the key, and after determining the first bit value, predicts the subsequent bit values, which significantly reduces the complexity and time cost of the attack, making the attack more efficient. BRIEF DESCRIPTION OF THE DRAWINGS

[0039] The drawings described herein are used to provide a further understanding of the present invention and constitute a part of the present invention. The exemplary embodiments of the present invention and their descriptions are used to explain the present invention and do not constitute an improper limitation of the present invention. In the drawings:

[0040] Figure 1 A schematic diagram of a weighted integrated neural network key prediction method provided by the present invention;

[0041] Figure 2 A schematic diagram of the structure of a residual neural network provided by the present invention;

[0042] Figure 3A structural block diagram of a weighted integrated neural network key prediction device provided by the present invention;

[0043] Figure 4 A schematic diagram of a computer device for implementing a weighted integrated neural network key prediction method provided by the present invention. DETAILED DESCRIPTION

[0044] In order to make the purpose, technical solution and advantages of the present invention clearer, the technical solution of the present invention will be clearly and completely described below in conjunction with the specific embodiments of the present invention and the corresponding drawings. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without making creative work are within the scope of protection of the present invention.

[0045] At present, machine learning, as the core technology of artificial intelligence, has demonstrated its powerful capabilities in many fields, such as image recognition, autonomous driving, and natural language processing. At the theoretical analysis level, the cryptanalysis methods based on machine learning are basically applied to block ciphers, and there are few analyses of sequence ciphers. Stream ciphers have high initialization rounds, and the differential features are propagated, diffused, and obfuscated, so that they cannot be detected in the end. Existing technologies cannot be applied to stream ciphers.

[0046] When solving the above problems, the existing mainstream technologies usually use differential features to construct ND to exceed the performance of pure differential distinguishers based on DDT, and use enough neutral bits in the initial differential to achieve key recovery. However, the high initialization round number of stream ciphers makes this method ineffective, unable to establish an effective ND, and the analysis ability of stream ciphers is weak.

[0047] At present, stream ciphers usually use a key to generate a pseudo-random key stream, and then use the key stream to encrypt the plaintext data bit by bit; in the prior art, the key of the stream cipher is usually predicted by exhaustive method, but the bit length of the key is long, and the time complexity of the exhaustive method is exponential, which means that as the bit length increases, the time required for cracking will increase sharply. Therefore, the time complexity of predicting the key by exhaustive method is high.

[0048] Based on this, the present invention provides a weighted integrated neural network key prediction method. By utilizing the concepts of chosen plaintext attack and chosen initialization parameter vector attack of sequence cipher algorithm, a weighted integrated neural network key prediction method is proposed. This method can reduce the time complexity of predicting keys and has certain universality.

[0049] The weighted integrated neural network key prediction method provided in the embodiment of the present application can be applied to a server, which can be a server set up on a business platform, or a device such as a desktop computer, a laptop computer, etc. that can execute the solution of the present invention.

[0050] The technical solutions provided by various embodiments of the present invention are described in detail below in conjunction with the accompanying drawings.

[0051] In an exemplary embodiment, Figure 1 The present invention is a schematic diagram of a weighted integrated neural network key prediction method, which specifically includes the following steps:

[0052] S101, obtaining a plurality of preset groups of sample keys and initialization parameter vectors for a stream cipher algorithm.

[0053] The preset number of sample keys includes a plurality of sample keys whose first bit value is 0 and a plurality of sample keys whose first bit value is 1.

[0054] The stream cipher algorithm may be the Trivium algorithm, and the initialization parameter vector of the stream cipher algorithm may be an initialization vector (IV), which is randomly generated to ensure that the ciphertext generated by the same plaintext in different encryption processes is different. Therefore, the initialization parameter vector in this embodiment may be randomly generated.

[0055] The key is the main parameter used to generate a pseudo-random number sequence (key stream) during the encryption process, and multiple groups of preset numbers of sample keys can be randomly selected from the database. The number of sample keys in each group is a preset number, and the multiple groups can be 1000 groups, and the preset number can be 10,000, that is, 1000 groups randomly selected each include 10,000 keys as sample keys.

[0056] Each group of preset number of sample keys includes a plurality of sample keys whose first bit value is 0 and a plurality of sample keys whose first bit value is 1. Optionally, in each group of preset number of sample keys, the number of sample keys whose first bit value is 0 and the number of sample keys whose first bit value is 1 may be the same, that is, among 10000 sample keys, the first bit value of 5000 keys is 0, and the first bit value of 5000 keys is 1.

[0057] S102, inputting each set of preset number of sample keys and initialization parameter vectors into a sequence key algorithm respectively, to obtain multiple sets of preset number of sample key streams.

[0058] For any set of preset number of sample keys, the initialization parameter vector and the preset number of sample keys are input into the stream cipher algorithm to obtain a preset number of sample key streams, and the bit length of each sample key stream is the preset bit length; wherein the preset bit length can be 1600 bits.

[0059] Inputting the initialization parameter vector and a preset number of sample keys into a stream cipher algorithm to obtain a preset number of sample key streams may include: for any sample key, inputting the initialization parameter vector and the sample key into the stream cipher algorithm to obtain a sample key stream of a preset bit length.

[0060] Among them, the stream cipher algorithm can be Trivium. When generating a sample key stream with a length of 1600 bits, 1152 initialization rounds are used as the target. After 1152 initialization rounds in Trivium, a sample key stream with a length of 1600 bits can be obtained by continuing to iterate 1600 rounds.

[0061] S103, using the first bit value of the sample key as a label of the corresponding sample key stream, and using each group of preset number of sample key streams and corresponding labels as training data, training the residual neural network to obtain multiple key prediction models.

[0062] Each set of preset number of sample key streams and their corresponding labels are used as a set of training data, and the residual neural network is trained with each set of preset number of training data to obtain each set of preset number of key prediction models; for example, 1000 sets of preset number of samples can obtain 1000 key prediction models.

[0063] Specifically, in an exemplary embodiment, each group of a preset number of sample key streams and corresponding labels are used as training data to train the residual neural network to obtain multiple key prediction models, including: for any group of a preset number of sample key streams, a preset number of sample key streams and corresponding labels are used as training data, and the residual neural network is iteratively trained to obtain the loss function value of the residual neural network for each training; the parameters of the residual neural network are updated according to the loss function value of the residual neural network for each training until the residual neural network converges to determine the key prediction model.

[0064] Among them, the residual neural network includes a feature extraction module, a residual block and a prediction module; the residual neural network is iteratively trained to obtain the loss function value of the residual neural network for each training, including: for any training, the training data is input into the feature extraction module to obtain the features of the training data; the features of the training data are input into the residual block, and the deep features of the training data are extracted through multi-layer convolution and jump connections; the deep features of the training data are input into the prediction module to obtain the prediction results of the training data; the prediction results are compared with the labels of the training data to determine the loss function value of the residual neural network.

[0065] like Figure 2 As shown, Figure 2 Figure 1 is a structural diagram of a residual neural network. The residual neural network ResNet includes a feature extraction module, a residual block and a prediction module. The training data is input into the feature extraction module, and the feature extraction module outputs the features of the training data. The features of the training data are input into the residual block, and the deep features of the training data are extracted through multi-layer convolution and jump connections. The deep features of the training data are input into the prediction module to obtain the prediction results of the training data.

[0066] Specifically, the feature extraction module includes a 1D convolutional layer, a batch normalization layer, and a ReLU (Rectified Linear Unit) activation function.

[0067] First, the single-channel input of the training data is expanded to the specified channel data through a 1D convolution layer. Specifically, this layer extracts the input features of the residual neural network (single channel, which is a feature sequence in the present invention) into 64 channels. The convolution kernel size is set to 1, which means that the convolution operation will not cross adjacent elements, but will perform linear combinations element by element. This operation is used to perform preliminary feature extraction or channel expansion on the input signal, increase the dimension of the input data, and facilitate subsequent feature learning. The step size is set to 1, which means that only one unit is slid each time, that is, the input and output sizes remain consistent.

[0068] Then, the batch normalization layer is used to perform batch normalization on the training data with the specified number of channels to speed up the network convergence and prevent gradient explosion or disappearance. The training data with the specified number of channels is divided into smaller batches (mini-batches), and the output features of each mini-batch are standardized to have a mean of 0 and a variance of 1, and the output is readjusted through learnable parameters. Given an input of x, let β be a mini-batch, where m is the size of the batch and each data point is x i . Then the mean of each dimension of mini-batch can be obtained by the formula Calculate the variance by the formula Calculate and standardize the data according to the mean and variance, using the formula Calculation, where ε is a very small number to prevent zero error, usually 10-5. Finally, the obtained standardized data is linearly transformed by two learnable parameters γ and δ, which represent the scaling factor and offset respectively, as given by the formula The calculation is performed to enable the network to learn and adjust on the standardized data to adapt to the original data distribution.

[0069] Finally, the ReLU activation function is introduced to introduce nonlinearity to prevent gradient disappearance and enable the model to learn more complex features.

[0070] Among them, the rectification function (ReLU) introduces nonlinear transformation to prevent the network from degenerating into linear transformation, which can be expressed by formula (1). This activation function sets all values ​​less than 0 to 0 and keeps values ​​greater than 0 unchanged. This activation function is simple and efficient, and will not cause the gradient vanishing problem in the positive interval.

[0071] f(x)=max(0,x) (1)

[0072] Among them, x represents the point corresponding to the training data of the specified number of channels, and f(x) is the feature after passing through the rectification function ReLU activation function, that is, the feature of the training data.

[0073] The residual block is the core of the residual neural network. It extracts deep features through multiple layers of convolution and skip connections to ensure that the results will not get worse while increasing the depth of the network. The residual block consists of a 1D convolution layer, batch normalization, ReLU activation function, 1D convolution layer, batch normalization layer, and ReLU activation function. First, the features of the training data pass through a one-dimensional convolution layer, which uses a convolution kernel of 3 unit size, allowing the model to capture richer patterns in the local range. The output after convolution is passed to the batch normalization layer (BatchNorm1D), which is used to standardize the output, thereby accelerating convergence and ensuring a more stable training process. Then, nonlinearity is introduced through the ReLU activation function, and convolution and batch normalization operations are applied again. These two consecutive convolution operations can extract deep features from the data layer by layer. However, deep networks usually face the problem of vanishing gradients, which makes the model unable to be effectively trained. Therefore, the residual block adds the input data directly to the output of the last convolution layer through a skip connection, thus forming a residual connection. In this way, even if the convolutional layer fails to learn effective features, the input data can still be directly passed to the next layer, avoiding information loss and effectively alleviating the gradient vanishing problem in deep networks. Finally, the output of the module is obtained through the ReLU activation function.

[0074] Optionally, the residual block can also include a residual connection, which is not shown in the figure. By adding a branch to the input itself, the network can directly pass the loss value to the network ahead through its own branch during the back propagation process, thereby slowing down the decay of the network and allowing the network to be set deeper. Let is the mapping of the network before propagation, is the mapping of the network after propagation, and the process can be represented by the formula H(x)=F(x)+x.

[0075] The prediction module consists of three parts: a flatten layer, a fully connected layer, and an output layer. First, the high-dimensional features extracted from the residual block are mapped to low-dimensional features (flatten), and the results are passed to the fully connected layer. Through the operation of full connection, normalization, and activation functions, the model can gradually reduce the feature dimensions and extract more abstract features. Finally, the result is passed through the Sigmoid activation function (not shown in the figure), and the output value is mapped to the range of 0 to 1 to obtain the classification result.

[0076] Flattening layer: Flattens the multi-dimensional output from the residual block into a one-dimensional vector to facilitate processing by the fully connected layer. Fully connected layer: This layer receives the one-dimensional vector output by the flattening layer and maps it to the specified feature dimension. Output layer: Maps the above features to one feature, that is, obtains a predicted value, and then uses the Sigmoid activation function to map it to the range of 0 to 1 z∈[0,1], and predicts which category it inputs based on the threshold, that is, determines the prediction result. For example, if the threshold is greater than 0.1, the category is 1, and if the threshold is less than or equal to 0.5, the category is 0.

[0077] The Sigmoid activation function is shown in formula (2). This activation function is usually used in binary classification tasks to convert the result into a probability value and determine which category it belongs to based on the selected threshold.

[0078]

[0079] Among them, x is the input feature and σ(x) is the prediction result.

[0080] Optionally, the prediction results are compared with the labels of the training data to determine the loss function value of the residual neural network, including: calculating the initial loss function value of the residual neural network according to the prediction results and the labels through the binary cross entropy loss function corresponding to the binary classification task; and weight attenuating the initial loss function value to determine the loss function value.

[0081] The calculation formula of the cross entropy loss function is shown in formula (3). Substitute the prediction result and the corresponding label into formula (3) and use formula (3) to calculate the initial loss function value of the residual neural network.

[0082]

[0083] in, is the prediction result, y is the label, is the initial loss function value. This loss function indicates that when the difference between the label and the predicted value is too large, a larger penalty value will be given to make the residual neural network converge to a better result.

[0084] The initial loss function value is weighted attenuated to determine the loss function value, that is, the initial loss function is L2 regularized. The square sum of the weight parameters is added as a penalty term in the given initial loss function to prevent overfitting during the training process. This can be shown in formula (4).

[0085]

[0086] Among them, λ represents the regularization parameter, is the sum of the squares of all parameters in the residual neural network. total Represents the loss function value of the residual neural network, Loss original is the initial loss function value

[0087] The parameters of the residual neural network are updated according to the loss function value of the residual neural network in each training until the residual neural network converges and the key prediction model is determined. The residual neural network uses the Adam optimizer and sets the learning rate to 10. -4 , in order to update the parameters in the residual neural network through the loss function value; the loss is calculated using the binary cross entropy loss function and uses the L2 regularization penalty, whose parameter is set to 10 -4 .

[0088] Among them, the condition for the convergence of the residual neural network can be a preset number of iterations, for example, the residual neural network converges after 500 iterations. In each iterative training process, the prediction accuracy of the residual neural network trained each time can be calculated, and the residual neural network with the highest prediction accuracy is saved (usually saved after 20 iterations, that is, the residual neural network with the highest prediction accuracy is saved only after the loss function gradually stabilizes), and the residual neural network model with the highest prediction accuracy is determined as the key prediction model, that is, the parameters of the key prediction model are the parameters corresponding to the residual neural network with the highest prediction accuracy in the iterative training process.

[0089] Through the above operations, multiple key prediction models and multiple prediction accuracy rates are finally obtained.

[0090] S104, inputting the key stream of the ciphertext data to be cracked into multiple key prediction models respectively, and obtaining multiple first bit prediction values ​​of the key of the ciphertext data to be cracked.

[0091] The key stream of the ciphertext data to be cracked may be intercepted from the transmission path of the ciphertext to be cracked.

[0092] The key stream of the ciphertext data to be cracked is input into each key prediction model respectively, and the value of the first bit of the key of the ciphertext data to be cracked output by each key prediction model is obtained, that is, multiple first bit prediction values ​​of the key of the ciphertext data to be cracked are obtained.

[0093] S105, performing weighted integration processing on multiple first bit prediction values ​​to obtain a key prediction result of the ciphertext data to be cracked; the key prediction result includes the first bit value of the key of the ciphertext data to be cracked.

[0094] This embodiment adopts the Softmax weighted method to perform key prediction, and by smoothing the model accuracy, prevents the accuracy from being too high or too low so as to affect the final key prediction result, thereby improving the robustness of the prediction.

[0095] In an exemplary embodiment, a plurality of first bit prediction values ​​are weighted and integrated to obtain a key prediction result of the ciphertext data to be cracked, including the following steps:

[0096] S201, obtaining prediction accuracy rates of multiple key prediction models, and normalizing the multiple prediction accuracy rates to obtain a normalized weight of each key prediction model.

[0097] For example, suppose there are n trained key prediction models, and the corresponding multiple prediction accuracies can be used as a set of weights {w1,w2,…,w n}, first use the Softmax function to perform probability conversion, that is, normalization, as shown in Formula 5.

[0098]

[0099] Where n is the number of prediction accuracy, ω i is the prediction accuracy of the i-th prediction, Softmax(w i ) is the ith normalized weight, and e is the base of the natural logarithm (approximately 2.718).

[0100] S202, weighting multiple first bit prediction values ​​according to the normalized weight of each key prediction model to obtain the prediction value of the ciphertext data to be cracked.

[0101] By using formula (5), the normalized weight corresponding to each key prediction model can be calculated: Given the multiple first bit prediction values ​​of the key of the ciphertext data to be cracked, {p1,p2,...,p n}, then the predicted value of the ciphertext data to be cracked is expressed by formula (6).

[0102]

[0103] in, is the predicted value of the ciphertext data to be cracked.

[0104] S203, if the predicted value is greater than a preset threshold, the key prediction result is determined to be 1; if the predicted value is less than or equal to the preset threshold, the key prediction result is determined to be 0.

[0105] A preset threshold may be set, and if the predicted value is greater than the preset threshold, the key prediction result is determined to be 1; if the predicted value is less than or equal to the preset threshold, the key prediction result is determined to be 0. For example, the preset threshold may be 0.5.

[0106] The average accuracy of 1,000 models obtained by this method is about 52.7%. In order to verify the prediction accuracy of the weighted ensemble neural network, five data sets for verification were randomly generated using the Trivium sequence cryptography algorithm. On these five data sets, the number of 1-bit key recovery correctness exceeded 5,000, exceeding the accuracy of random selection. At the same time, this method can also perform multi-bit prediction by increasing the number of labels, which is actually processing a multi-classification task (the amount of data also needs to be increased).

[0107] This method utilizes the core concepts of chosen plaintext attack and chosen IV attack, obtains corresponding data through existing cryptographic algorithms to build a data set, and then further predicts by integrating multiple neural network models, which can improve the accuracy of the prediction.

[0108] The weighted integrated neural network key prediction method provided by the present invention aims at machine learning-assisted cryptanalysis for sequence ciphers, and uses the core concepts of selected initialization vector attack and chosen plaintext attack to construct a data set through existing data, and uses supervised learning to abstract key prediction into a binary classification task, and learn and predict with residual neural network. Multi-model training is performed through multiple groups of data, and the accuracy of multi-model prediction results is evaluated in a probability weighted manner, thereby improving the accuracy of key prediction results.

[0109] When applying the weighted integrated neural network key prediction method provided by the present invention, it is not necessary to Figure 1 The steps are executed in the order shown. The specific execution order of the steps can be determined according to needs, and the present invention does not limit this.

[0110] The above is a weighted integrated neural network key prediction method provided by one or more embodiments of the present invention. Based on the same idea, the present invention also provides a corresponding weighted integrated neural network key prediction device, such as Figure 3 shown.

[0111] Figure 3 The present invention provides a structural block diagram of a weighted integrated neural network key prediction device, the device 300 includes:

[0112] The acquisition module 301 is used to acquire a plurality of preset groups of sample keys and initialization parameter vectors for a stream cipher algorithm.

[0113] The sample generation module 302 is used to input each set of preset number of sample keys and the initialization parameter vector into the sequence key algorithm to obtain multiple sets of preset number of sample key streams.

[0114] The training module 303 is used to use the first bit value of the sample key as the label of the corresponding sample key stream, and use each group of preset number of sample key streams and corresponding labels as training data to train the residual neural network to obtain multiple key prediction models.

[0115] The output module 304 is used to input the key streams of the ciphertext data to be cracked into the multiple key prediction models respectively to obtain multiple first bit prediction values ​​of the key of the ciphertext data to be cracked.

[0116] The weighted integration module 305 is used to perform weighted integration processing on the multiple first bit prediction values ​​to obtain the key prediction result of the ciphertext data to be cracked; the key prediction result includes the first bit value of the key of the ciphertext data to be cracked.

[0117] For the specific definition of the key prediction device, please refer to the definition of the weighted integrated neural network key prediction method above, which will not be repeated here. Each module in the above-mentioned key prediction device can be implemented in whole or in part by software, hardware and a combination thereof. The above-mentioned modules can be embedded in or independent of the processor in the computer device in the form of hardware, or can be stored in the memory of the computer device in the form of software, so that the processor can call and execute the operations corresponding to the above modules.

[0118] The present invention also provides a computer-readable storage medium, which stores a computer program, which can be used to execute the above Figure 1 The proposed weighted ensemble neural network key prediction method.

[0119] The present invention also provides Figure 4 The structural diagram of the computer device shown in FIG. Figure 4 As shown in the figure, at the hardware level, the computer device includes a processor, an internal bus, a network interface, a memory, and a non-volatile memory, and may also include other hardware required for the business. The processor reads the corresponding computer program from the non-volatile memory into the memory and then runs it to achieve the above Figure 1 The proposed weighted ensemble neural network key prediction method.

[0120] Those skilled in the art can understand that all or part of the processes in the above-mentioned embodiment methods can be completed by instructing the relevant hardware through a computer program, and the computer program can be stored in a non-volatile computer-readable storage medium. When the computer program is executed, it can include the processes of the embodiments of the above-mentioned methods. Among them, any reference to memory, storage, database or other media used in the embodiments provided by the present invention can include at least one of non-volatile and volatile memory. Non-volatile memory can include read-only memory (ROM), magnetic tape, floppy disk, flash memory or optical memory, etc. Volatile memory can include random access memory (RAM) or external cache memory. As an illustration and not limitation, RAM can be in various forms, such as static random access memory (SRAM) or dynamic random access memory (DRAM).

[0121] The technical features of the above embodiments may be arbitrarily combined. To make the description concise, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of the present invention.

Claims

1. A weighted integrated neural network key prediction method, characterized in that: The method comprises: Obtaining a plurality of sets of preset numbers of sample keys and initialization parameter vectors for a stream cipher algorithm; Inputting each set of preset number of sample keys and the initialization parameter vector into the stream cipher algorithm respectively to obtain multiple sets of preset number of sample key streams; The first bit value of the sample key is used as the label of the corresponding sample key stream, and each group of preset number of sample key streams and corresponding labels are used as training data to train the residual neural network to obtain multiple key prediction models, including: For any set of preset number of sample key streams, the preset number of sample key streams and corresponding labels are used as training data; the residual neural network includes a feature extraction module, a residual block and a prediction module; the residual neural network is iteratively trained to obtain the loss function value of the residual neural network for each training, including: for any training, the training data is input into the feature extraction module to obtain the features of the training data; the features of the training data are input into the residual block, and the deep features of the training data are extracted through multi-layer convolution and jump connection; the deep features of the training data are input into the prediction module to obtain the prediction result of the training data; the prediction result is compared with the label of the training data to determine the loss function value of the residual neural network; Updating the parameters of the residual neural network according to the loss function value of the residual neural network trained each time until the residual neural network converges, and determining the key prediction model; Inputting the key streams of the ciphertext data to be cracked into the multiple key prediction models respectively to obtain multiple first bit prediction values ​​of the key of the ciphertext data to be cracked; The multiple first bit prediction values ​​are weighted and integrated to obtain a key prediction result of the ciphertext data to be cracked; the key prediction result includes the first bit value of the key of the ciphertext data to be cracked.

2. The method according to claim 1, characterized in that: The step of comparing the prediction result with the label of the training data to determine the loss function value of the residual neural network includes: According to the prediction result and the label, the initial loss function value of the residual neural network is calculated by using the binary cross entropy loss function corresponding to the binary classification task; The initial loss function value is weighted attenuated to determine the loss function value.

3. The method according to claim 1, characterized in that The parameters of the key prediction model are the parameters corresponding to the residual neural network with the highest prediction accuracy during the iterative training process.

4. The method according to claim 1, characterized in that: The step of performing weighted integration processing on the plurality of first bit prediction values ​​to obtain a key prediction result of the ciphertext data to be cracked includes: Obtaining prediction accuracy rates of the multiple key prediction models, and normalizing the multiple prediction accuracy rates to obtain a normalized weight of each key prediction model; According to the normalized weight of each key prediction model, multiple first bit prediction values ​​are weighted to obtain the prediction value of the ciphertext data to be cracked; If the predicted value is greater than a preset threshold, determining that the key prediction result is 1; If the predicted value is less than or equal to the preset threshold, the key prediction result is determined to be 0.

5. A weighted integrated neural network key prediction device, characterized in that: include: An acquisition module, used for acquiring a plurality of sets of preset number of sample keys and initialization parameter vectors for a stream cipher algorithm; A sample generation module, used for inputting each set of preset number of sample keys and the initialization parameter vector into the stream cipher algorithm to obtain multiple sets of preset number of sample key streams; The training module is used to use the first bit value of the sample key as the label of the corresponding sample key stream, and use each group of preset number of sample key streams and corresponding labels as training data to train the residual neural network to obtain multiple key prediction models, including: For any set of preset number of sample key streams, the preset number of sample key streams and corresponding labels are used as training data; the residual neural network includes a feature extraction module, a residual block and a prediction module; the residual neural network is iteratively trained to obtain the loss function value of the residual neural network for each training, including: for any training, the training data is input into the feature extraction module to obtain the features of the training data; the features of the training data are input into the residual block, and the deep features of the training data are extracted through multi-layer convolution and jump connection; the deep features of the training data are input into the prediction module to obtain the prediction result of the training data; the prediction result is compared with the label of the training data to determine the loss function value of the residual neural network; Updating the parameters of the residual neural network according to the loss function value of the residual neural network trained each time until the residual neural network converges, and determining the key prediction model; An output module, used for inputting the key streams of the ciphertext data to be cracked into the multiple key prediction models respectively, to obtain multiple first bit prediction values ​​of the key of the ciphertext data to be cracked; The weighted integration module is used to perform weighted integration processing on the multiple first bit prediction values ​​to obtain the key prediction result of the ciphertext data to be cracked; the key prediction result includes the first bit value of the key of the ciphertext data to be cracked.

6. A computer-readable storage medium, characterized in that: The storage medium stores a computer program, and when the computer program is executed by a processor, the method according to any one of claims 1 to 4 is implemented.

7. A computer device, characterized in that: The method comprises a memory, a processor and a computer program stored in the memory and executable on the processor, wherein when the processor executes the program, the method according to any one of claims 1 to 4 is implemented.

Citation Information

Patent Citations

  • Equivalent key acquisition method and device and computer readable storage medium

    CN110071798A

  • Physical layer label signal embedding authentication method and system based on WFRFT

    CN112188483A