Data encryption and decryption model training method and device, equipment and medium

By integrating and randomly selecting ciphertext files with different encryption algorithms to train the transformer model, a data encryption model with randomness is generated, which solves the problem that existing encryption modes are easily cracked and achieves more efficient data protection.

CN116204905BActive Publication Date: 2026-11-24CHINA MOBILE INFORMATION TECHNOLOGY CO LTD +1
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202310147718.2
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2023-02-20
Publication Date
2026-11-24
Estimated Expiration
2043-02-20

AI Technical Summary

Technical Problem

Existing encryption methods cannot effectively guarantee data security when a problem occurs at one stage, and the decryption process is easily cracked, resulting in insufficient data security.

Method used

By acquiring ciphertext files with multiple different encryption algorithms, integrating and randomly selecting ciphertext data, and training a transformer model to generate a data encryption model with randomness, the training difficulty and encryption effect are improved.

Benefits of technology

It enhances the security and anti-cracking capabilities of the data encryption model, improves encryption effectiveness, adapts to the randomness of various encryption algorithms, and strengthens data protection.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN116204905B_ABST
    Figure CN116204905B_ABST
Patent Text Reader

Abstract

This application discloses a training method, apparatus, device, and medium for a data encryption and decryption model. The method includes obtaining a first plaintext file and multiple first ciphertext files corresponding to the first plaintext data, each first ciphertext file corresponding to a different encryption algorithm; integrating the multiple first ciphertext files to obtain an integrated ciphertext file; randomly selecting ciphertext data from the integrated ciphertext file to obtain multiple second ciphertext files; and training a transformer model using the first plaintext file as the independent variable and the multiple second ciphertext files as the dependent variable to obtain a first data encryption model. The training samples for the first data encryption model in this application are second ciphertext files randomly obtained from the multiple first ciphertext files. Since each first ciphertext file is obtained using a different encryption algorithm, by increasing the training difficulty, the first data encryption model can randomly encrypt using multiple encryption methods, thereby improving the encryption effect of the first data encryption model.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application belongs to the field of information security technology, and in particular relates to a training method, apparatus, device and medium for a data encryption and decryption model. Background Technology

[0002] In recent years, with the continuous development of the "Internet+" model, the demand for electronic transactions in economic activities has been increasing. The transaction data generated in electronic transactions has important value, and the security of the data is becoming increasingly important.

[0003] To protect transaction data, it is often encrypted using various methods such as passwords or QR codes. The existing encryption method is mainly a serial encryption mode, which is linked one link after another. If one link fails, encryption cannot be achieved. Even if encryption is successful, if the QR codes are cracked one by one during the decryption process, the encryption mode will also be cracked. Even if it is not cracked, as long as one link in the encryption mode is broken, the encryption mode will not work properly.

[0004] Therefore, traditional encryption methods cannot adequately guarantee data security. Summary of the Invention

[0005] This application provides a training method, apparatus, device, and medium for a data encryption and decryption model, which improves the effectiveness of data encryption.

[0006] According to a first aspect of this application, embodiments of this application provide a method for training a data encryption model, the method comprising:

[0007] Obtain the first plaintext file and multiple first ciphertext files corresponding to the first plaintext data, each first ciphertext file having a different encryption algorithm;

[0008] Multiple first-level ciphertext files are integrated to obtain a combined ciphertext file;

[0009] Randomly select ciphertext data from the integrated ciphertext file to obtain multiple second ciphertext files;

[0010] Using the first plaintext file as the independent variable and multiple second ciphertext files as dependent variables, a transformer model is trained to obtain the first data encryption model.

[0011] Optionally, the first plaintext file is at least one of the following: a text file, an image file, or an audio / video file.

[0012] Optionally, ciphertext data is randomly selected from the integrated ciphertext file to obtain multiple second ciphertext files, including:

[0013] The integrated ciphertext file is split into multiple third-party ciphertext files;

[0014] Randomly select ciphertext data located at the same position from each of the third ciphertext files;

[0015] The ciphertext data at the same selected positions are randomly arranged to obtain multiple second ciphertext files.

[0016] Optionally, using the first plaintext file as the independent variable and multiple second ciphertext files as dependent variables, a transformer model is trained to obtain a first data encryption model, including:

[0017] The first plaintext file is vectorized to obtain the feature vector;

[0018] The feature vectors are processed sequentially through the multi-head self-attention, residual, normalization, fully connected, residual and normalization processes of the transformer model to obtain the attention hidden vectors.

[0019] Based on the attention-hidden vector, predict the predicted ciphertext of the first plaintext file;

[0020] The loss function of the transformer model is determined based on the predicted ciphertext and multiple second ciphertext files.

[0021] The first data encryption model is obtained when the loss function meets the preset stopping condition;

[0022] If the loss function does not meet the preset stopping condition, the parameters of the transformer model are adjusted, and multiple second ciphertext files are obtained by randomly selecting ciphertext data from the integrated ciphertext file until the loss function meets the preset stopping condition, thus obtaining the first data encryption model.

[0023] Optionally, after obtaining the first data encryption model, the method further includes:

[0024] Obtain the second plaintext file and the corresponding fourth ciphertext file;

[0025] Using the second plaintext file as the independent variable of the first data encryption model and the fourth ciphertext file as the dependent variable of the first data encryption model, the first data encryption model is trained to obtain the second data encryption model.

[0026] According to a second aspect of this application, embodiments of this application provide a method for training a data decryption model, the method comprising:

[0027] Obtain the fifth ciphertext file and the third plaintext file. The fifth ciphertext file is the ciphertext file obtained by encrypting the third plaintext file using the first data encryption model.

[0028] Using the fifth ciphertext file as the independent variable of the transformer model and the third plaintext file as the dependent variable, the transformer model is trained to obtain the data decryption model.

[0029] According to a third aspect of this application, embodiments of this application provide a data encryption model training apparatus, comprising:

[0030] The first acquisition module is used to acquire the first plaintext file and multiple first ciphertext files corresponding to the first plaintext data, and each first ciphertext file has a different encryption algorithm.

[0031] The integration module is used to integrate multiple first-level ciphertext files to obtain an integrated ciphertext file.

[0032] The selection module is used to randomly select ciphertext data from the integrated ciphertext file to obtain multiple second ciphertext files;

[0033] The first training module is used to train the transformer model with the first plaintext file as the independent variable and multiple second ciphertext files as the dependent variable, to obtain the first data encryption model.

[0034] According to a fourth aspect of this application, embodiments of this application provide a data decryption model training apparatus, comprising:

[0035] The second acquisition module is used to acquire the fifth ciphertext file and the third plaintext file. The fifth ciphertext file is the ciphertext file obtained by encrypting the third plaintext file through the first data encryption model.

[0036] The second training module is used to train the transformer model using the fifth ciphertext file as the independent variable and the third plaintext file as the dependent variable, thus obtaining the data decryption model.

[0037] According to a fifth aspect of this application, an embodiment of this application provides a training apparatus for a model, the apparatus comprising: a processor and a memory storing computer program instructions;

[0038] The training method for the data encryption model that implements any one of the first aspects and / or the training method for the data decryption model in the second aspect when the processor executes computer program instructions.

[0039] According to a sixth aspect of this application, embodiments of this application provide a computer storage medium storing computer program instructions, which, when executed by a processor, implement a training method for a data encryption model of any one of the first aspects and / or a training method for a data decryption model of the second aspect.

[0040] According to a seventh aspect of this application, embodiments of this application provide a computer program product in which instructions, when executed by a processor of an electronic device, cause the electronic device to perform a training method for a data encryption model of any one of the first aspects and / or a training method for a data decryption model of the second aspect.

[0041] The encryption and decryption model training method, apparatus, device, and medium of this application embodiment obtain a first plaintext file and multiple first ciphertext files obtained through multiple encryption methods. These first ciphertext files are then integrated to obtain an integrated ciphertext file. Ciphertext data is randomly selected from the integrated ciphertext file to obtain multiple second ciphertext files. These second ciphertext files are then shuffled to make them random. A transformer model is then trained based on the first plaintext file and the multiple second ciphertext files to finally obtain a first data encryption model. Since the training samples of the first data encryption model are second ciphertext files randomly obtained from the multiple first ciphertext files, which have uncertainty, and each first ciphertext file is obtained from a different encryption algorithm, increasing the training difficulty allows the first data encryption model to use multiple encryption methods for random encryption, thus improving the encryption effect of the first data encryption model. Attached Figure Description

[0042] To more clearly illustrate the technical solutions of the embodiments of this application, the accompanying drawings used in the embodiments of this application will be briefly introduced below. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.

[0043] Figure 1 This is a flowchart illustrating a training method for a data encryption model according to an exemplary embodiment;

[0044] Figure 2 This is another flowchart illustrating a training method for a data encryption model according to an exemplary embodiment;

[0045] Figure 3 This is another flowchart illustrating a training method for a data encryption model according to an exemplary embodiment;

[0046] Figure 4This is another flowchart illustrating a training method for a data encryption model according to an exemplary embodiment;

[0047] Figure 5 This is a flowchart illustrating a training method for a data decryption model according to an exemplary embodiment;

[0048] Figure 6 This is a structural block diagram of a training device for a data encryption model according to an exemplary embodiment;

[0049] Figure 7 This is a structural block diagram of a training apparatus for a data decryption model according to an exemplary embodiment;

[0050] Figure 8 This is a structural block diagram of a training device for a data encryption and decryption model, according to an exemplary embodiment. Detailed Implementation

[0051] The features and exemplary embodiments of various aspects of this application will be described in detail below. To make the objectives, technical solutions, and advantages of this application clearer, the application will be further described in detail below with reference to the accompanying drawings and specific embodiments. It should be understood that the specific embodiments described herein are only intended to explain this application and not to limit it. For those skilled in the art, this application can be implemented without some of these specific details. The following description of the embodiments is merely to provide a better understanding of this application by illustrating examples.

[0052] It should be noted that, in this document, relational terms such as "first" and "second" are used merely to distinguish one entity or operation from another, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Furthermore, the terms "comprising," "including," or any other variations thereof are intended to cover non-external inclusion, such that a process, method, article, or apparatus that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such a process, method, article, or apparatus. Without further limitations, an element defined by the phrase "comprising..." does not exclude the presence of additional identical elements in the process, method, article, or apparatus that includes said element.

[0053] As described in the background section, in order to protect transaction data, existing technologies often encrypt transaction data using various methods such as passwords or QR codes. The existing encryption methods are mainly serial encryption modes, which are linked one by one. If one link fails, encryption cannot be achieved. Even if encryption is completed, if the QR codes are cracked one by one during the decryption process, the encryption mode will also be cracked. Even if it is not cracked, as long as one link in the encryption mode is broken, the encryption mode cannot be used normally.

[0054] Based on this, in the data encryption and decryption model training method provided in this application embodiment, a first plaintext file and multiple first ciphertext files obtained through multiple encryption methods are acquired. The multiple first ciphertext files are integrated to obtain an integrated ciphertext file. Then, ciphertext data is randomly selected from the integrated ciphertext file to obtain multiple second ciphertext files. The multiple first ciphertext files are shuffled to make the second ciphertext files random. Then, a transformer model is trained based on the first plaintext file and the multiple second ciphertext files to finally obtain the first data encryption model. Since the training samples of the first data encryption model are second ciphertext files randomly obtained from the multiple first ciphertext files, which have uncertainty, and each first ciphertext file is obtained by different encryption algorithms, the training difficulty is increased so that the first data encryption model can use multiple encryption methods to encrypt randomly, thereby improving the encryption effect of the first data encryption model.

[0055] This application provides a method, apparatus, device, and medium for training a data encryption and decryption model. The training method for the data encryption model provided in the embodiments of this application will be described first below.

[0056] Figure 1 This illustration shows a flowchart of a training method for a data encryption model provided in one embodiment of this application. Figure 1 As shown, the method may include the following steps:

[0057] S101, obtain the first plaintext file and multiple first ciphertext files corresponding to the first plaintext data, each first ciphertext file having a different encryption algorithm;

[0058] S102, integrate multiple first ciphertext files to obtain the integrated ciphertext file;

[0059] S103, randomly select ciphertext data from the integrated ciphertext file to obtain multiple second ciphertext files;

[0060] S104. Using the first plaintext file as the independent variable of the model and multiple second ciphertext files as dependent variables, train the transformer model to obtain the first data encryption model.

[0061] Based on the above embodiments, by obtaining a first plaintext file and multiple first ciphertext files obtained through multiple encryption methods, the multiple first ciphertext files are integrated to obtain an integrated ciphertext file. Then, ciphertext data is randomly selected from the integrated ciphertext files to obtain multiple second ciphertext files. The multiple first ciphertext files are shuffled to make the second ciphertext files random. Then, a transformer model is trained based on the first plaintext file and the multiple second ciphertext files to finally obtain the first data encryption model. Since the training samples of the first data encryption model are second ciphertext files randomly obtained from the multiple first ciphertext files, which have uncertainty, and each first ciphertext file is obtained by different encryption algorithms, by increasing the training difficulty, the first data encryption model can use multiple encryption methods to randomly encrypt, thereby improving the encryption effect of the first data encryption model.

[0062] In S101, a plaintext file can be encrypted into different encrypted files using different encryption algorithms. Therefore, encrypting the first plaintext file using multiple different encryption algorithms can yield multiple different first ciphertext files.

[0063] Specifically, the first plaintext file can be at least one of a text file, an image file, or an audio / video file.

[0064] As an example, when the first plaintext file is a text file, assuming there are two encryption algorithms, A and B, and the first plaintext file is 12345, the first encrypted file obtained by encryption algorithm A can be 54321, and the first encrypted file obtained by encryption algorithm B can be 23456. Therefore, encrypting the first text file with multiple different encryption algorithms can yield multiple different first encrypted files. Similarly, if the first plaintext file is an image file or an audio / video file, multiple different first encrypted files can also be obtained.

[0065] In S102, multiple different first ciphertext files are integrated together to generate an integrated ciphertext file. In other words, the integrated ciphertext file is actually a set of first ciphertext files that includes multiple different first ciphertext files.

[0066] As an example, based on the above example, the first ciphertext file can be 54321, or it can be 23456. Then the combined ciphertext file is 54321, 23456.

[0067] In S103, the first ciphertext file is composed of multiple ciphertext data. Multiple ciphertext data can be randomly selected from the integrated ciphertext data, and these multiple ciphertext data form the second ciphertext file. Since the selection is random, there are multiple permutations and combinations, so multiple second ciphertext files can be obtained.

[0068] As an example, if the integrated ciphertext files are 54321 and 23456, then randomly selecting ciphertext data from them can yield 2 to the power of 5 second ciphertext files. Similarly, if the first plaintext file is an image file or an audio / video file, multiple second ciphertext files can be obtained by dividing the image file into different regions or the audio file into different segments and then randomly selecting them.

[0069] In S104, the first plaintext text is input into the transformer model to obtain a predicted ciphertext. The first predicted ciphertext and multiple second ciphertext files are used to train the transformer model. Since the second ciphertext files are obtained from the first ciphertext files obtained from different encryption algorithms, and are randomly selected after integration, they have a great deal of uncertainty. Therefore, the first data encryption model that has been trained can finally obtain a model that can perform encryption calculations through multiple different encryption algorithms.

[0070] In order to improve the data encryption effect of the encryption model, this application also provides another implementation of the training method of the data encryption model.

[0071] like Figure 2 Another flowchart illustrating the training method of the data encryption model provided in one embodiment of this application is shown, as follows: Figure 2 As shown, S103 above may include:

[0072] S201, split the integrated ciphertext file into multiple third-party ciphertext files;

[0073] S202, randomly select ciphertext data located at the same position from each of the third ciphertext files;

[0074] S203, randomly arrange the ciphertext data at the same selected positions to obtain multiple second ciphertext files.

[0075] Based on the above embodiments, multiple second ciphertext files are obtained by splitting, randomly selecting, and randomly arranging the integrated ciphertext file, so that the number of second ciphertext files increases exponentially. Since the second ciphertext files are randomly arranged, the second ciphertext files are uncertain when training the transformer model, which can increase the training difficulty of the model and thus improve the encryption effect of the first data encryption model.

[0076] In one embodiment, assuming the first ciphertext file is a text file, as an example, assuming the integrated ciphertext file has a total of m×n lines, then the integrated ciphertext file can be split into m third ciphertext files, each of which has n lines.

[0077] The third ciphertext file containing n lines is randomly shuffled. Since n is arbitrarily specified, this step can be done in memory. Then, the first line of each third ciphertext file is read, which is the ciphertext data at the same position (resulting in m lines of data).

[0078] By randomly arranging the ciphertext data of the first line of each third ciphertext file, and then the second, third, and so on up to the nth line, we can obtain m second ciphertext files.

[0079] In another embodiment, assuming the first ciphertext file is an image file, as an example, after each image file is segmented, for example, if the image file is 224×224, the image file is segmented with a 16×16 size frame to obtain 14 image regions, that is, the resulting integrated ciphertext file has m×n parts. Then the integrated ciphertext file can be split into m third ciphertext files, and each third ciphertext file has n image regions.

[0080] Then, the third ciphertext file containing n image regions is randomly shuffled, and the first image region is read from it, and so on until the nth region.

[0081] By randomly arranging the image regions of the first block of each third ciphertext file, and then the second, third, and so on up to the nth block, m second ciphertext files can be obtained.

[0082] To improve the encryption effect of the data encryption model, this application also provides another implementation of the training method for the data encryption model.

[0083] like Figure 3 This illustration shows another flowchart of the training method for a data encryption model provided in one embodiment of this application, as follows: Figure 3 As shown, S104 above may include:

[0084] S301, Perform feature vectorization on the first plaintext file to obtain the feature vector;

[0085] S302, the feature vector is processed sequentially through the multi-head self-attention, residual, normalization, fully connected, residual and normalization processes of the transformer model to obtain the attention hidden vector;

[0086] S303, based on the attention-hidden vector, predict the predicted ciphertext of the first plaintext file;

[0087] S304, Determine the loss function of the transformer model based on the predicted ciphertext and multiple second ciphertext files;

[0088] S305, under the condition that the loss function satisfies the preset stopping condition, the first data encryption model is obtained;

[0089] S306: If the loss function does not meet the preset stop condition, adjust the parameters of the transformer model, and return to the step of randomly selecting ciphertext data from the integrated ciphertext files to obtain multiple second ciphertext files, until the loss function meets the preset stop condition, so as to obtain the first data encryption model.

[0090] Based on the above embodiments, the predicted ciphertext of the first plaintext file is calculated by using the processing method of multi-head self-attention + residual connection + normalization + fully connected layer + residual connection + normalization in the transformer model, and then the loss function of the transformer model is calculated according to the predicted ciphertext and the second ciphertext files, and the first data encryption model is determined by taking the value of the loss function as the judgment condition. In the process of determining the first data encryption model, the predictive translation function of the transformer model is utilized, which not only improves the accuracy of the predicted ciphertext, but also increases the training speed of the first data encryption model, thereby further improving the encryption effect of the first data encryption model.

[0091] In S301, each ciphertext data in the text file or each image region in the image file is input into the encoder in the transformer model through the self-attention mechanism, so as to determine the hidden features corresponding to the first plaintext file.

[0092] The transformer model can predict the predicted ciphertext based on partial information in the predicted ciphertext, combined with hidden features and weight values. For example, in one embodiment, if the predicted ciphertext contains the character "中", and the hidden feature is specifically word frequency, analysis from the perspective of word frequency shows that the weight value of "中国" is the highest, so it can be predicted that the next character after "中" is "国". Further, for the first data encryption model trained based on the transformer model, if the plaintext file has undergone occlusion operations such as hiding, modification, or replacement, resulting in missing partial information of the plaintext text, the first data encryption model can also predict the missing partial information based on the known information, thereby improving the practicability of the first data encryption model.

[0093] In S302, mutual interactive self-attention is then performed through the decoder, where the mutual interactive attention sequentially passes through multi-head self-attention, residual connection, normalization, fully connected layer, residual connection and normalization, so as to obtain the attention hidden vector corresponding to the first plaintext file.

[0094] In S303, if the first plaintext file includes text files and image files, the transformer model needs to fuse the attention hidden vectors corresponding to the text files and the attention hidden vectors corresponding to the image files. If the first plaintext file also includes audio and video files, then the attention hidden vectors corresponding to each of the three files need to be fused. The transformer model can predict the ciphertext based on the fused attention hidden vectors.

[0095] In S304, theoretically, if the first data encryption model is well trained, the resulting predicted ciphertext and the second ciphertext file should be identical. Therefore, during the training of the first data encryption model, it is necessary to calculate the loss function of the transformer model based on the predicted ciphertext and the second ciphertext file, which is to obtain the similarity between the predicted ciphertext and the second ciphertext file.

[0096] In S305, in one embodiment, the preset stopping condition is less than 0.002. That is, when the loss function of the transformer model is less than 0.002, it can be considered that the predicted ciphertext obtained by the above model has a similarity to the second ciphertext file within the error range, and the first data encryption model that has been trained can be obtained.

[0097] In S306, if the loss function does not meet the preset stopping condition, it is necessary to select ciphertext data from the integrated ciphertext file again to obtain multiple second ciphertext files, that is, to execute the above step S103 again; then determine the loss function of the transformer model based on the new ciphertext file and the predicted ciphertext until its loss function meets the preset stopping condition.

[0098] To improve the applicability of the data encryption model, this application also provides another implementation of the training method for the data encryption model.

[0099] like Figure 4 This illustration shows another flowchart of the training method for a data encryption model provided in one embodiment of this application, as follows: Figure 4 As shown, after S104 above, it may also include:

[0100] S401, Obtain the second plaintext file and the corresponding fourth ciphertext file;

[0101] S402, using the second plaintext file as the independent variable of the first data encryption model and the fourth ciphertext file as the dependent variable of the first data encryption model, train the first data encryption model to obtain the second data encryption model.

[0102] Based on the above embodiments, since the multiple first ciphertext files in the training samples are obtained based on different encryption algorithms when training the first encryption model, in order to meet more needs, when only one encryption algorithm is required, the first data encryption model is retrained based on the original first data encryption model, according to the second plaintext file and the fourth ciphertext file, to obtain the second data encryption model. This satisfies the model encryption method of one encryption method and improves the applicability of the second data encryption model.

[0103] In S401, the fourth ciphertext file is obtained from the second plaintext file using any encryption algorithm.

[0104] In S402, the second plaintext is input into the first data encryption model to obtain the second predicted ciphertext, and the loss function value of the first data encryption model is determined based on the second ciphertext and the fourth ciphertext file.

[0105] If the loss function value meets the preset stopping condition, then the second data encryption model is obtained.

[0106] If the preset stopping condition is not met, the process returns to obtain a new second plaintext file and uses the same encryption algorithm as in S401 above to obtain a new fourth ciphertext file, until the preset stopping condition is met.

[0107] The training method of the data decryption model provided in the embodiments of this application will be introduced first.

[0108] Figure 5 This illustration shows a flowchart of a training method for a data decryption model provided in one embodiment of this application. Figure 5 As shown, the method may include the following steps:

[0109] S501, Obtain the fifth ciphertext file and the third plaintext file. The fifth ciphertext file is the ciphertext file obtained by encrypting the third plaintext file using the first data encryption model.

[0110] S502, using the fifth ciphertext file as the independent variable of the transformer model and the third plaintext file as the dependent variable of the transformer model, train the transformer model to obtain the data decryption model.

[0111] Based on the above embodiments, encryption and decryption are interdependent in actual production and life. Therefore, after determining the first data encryption model, it is necessary to determine the plaintext file before the first data encryption model based on the fifth ciphertext file. Only in this way can the encryption and decryption of the third plaintext file be completed. Based on the same principle as the first encryption model, the data decryption model is obtained, realizing the correspondence between encryption and decryption, and effectively meeting the needs of actual production and life.

[0112] In S501, inputting the third plaintext file into the first data encryption model yields the fifth ciphertext file.

[0113] In S502, the third plaintext file is input into the transformer model, and the predicted plaintext can be obtained using the transformer model. The loss function value of the transformer model is determined based on the predicted plaintext and the third plaintext file. If the preset stopping condition is met, the data decryption model is obtained. If the preset stopping condition is not met, the process returns to S501, and a new third plaintext file is input into the first data encryption model to obtain a new fifth ciphertext file, until the loss function value of the transformer model meets the preset condition.

[0114] It should be noted that the application scenarios described in the above embodiments of this application are for the purpose of more clearly illustrating the technical solutions of the embodiments of this application, and do not constitute a limitation on the technical solutions provided by the embodiments of this application. As those skilled in the art will know, with the emergence of new application scenarios, the technical solutions provided by the embodiments of this application are also applicable to similar technical problems.

[0115] Based on the same inventive concept, this application also provides a data encryption model training device. Specifically, in conjunction with... Figure 6 Please provide a detailed explanation.

[0116] Figure 6 A schematic diagram of the hardware structure of the data encryption model training device 600 provided in an embodiment of the present invention is shown.

[0117] like Figure 6 As shown, the data encryption model training device 600 may include:

[0118] The first acquisition module 610 is used to acquire a first plaintext file and multiple first ciphertext files corresponding to the first plaintext data, each first ciphertext file having a different encryption algorithm.

[0119] Integration module 620 is used to integrate multiple first ciphertext files to obtain an integrated ciphertext file;

[0120] Module 630 is used to randomly select ciphertext data from the integrated ciphertext file to obtain multiple second ciphertext files;

[0121] The first training module 640 is used to train a transformer model with the first plaintext file as the independent variable and multiple second ciphertext files as the dependent variable, so as to obtain the first data encryption model.

[0122] In the training device 600 for the data encryption model provided in this embodiment, the first acquisition module 610 acquires a first plaintext file and multiple first ciphertext files obtained through multiple encryption methods. The integration module 620 integrates the multiple first ciphertext files to obtain an integrated ciphertext file. The selection module 630 then randomly selects ciphertext data from the integrated ciphertext files to obtain multiple second ciphertext files. The multiple first ciphertext files are then shuffled to make the second ciphertext files random. The first training module 640 then trains a transformer model based on the first plaintext file and the multiple second ciphertext files to finally obtain the first data encryption model. Since the training samples of the first data encryption model are second ciphertext files randomly obtained from the multiple first ciphertext files, which have uncertainty, and each first ciphertext file is obtained by a different encryption algorithm, by increasing the training difficulty, the first data encryption model can use multiple encryption methods to randomly encrypt, thereby improving the encryption effect of the first data encryption model.

[0123] Optionally, the selection module 630 may include:

[0124] Splitting units are used to split the integrated ciphertext file into multiple third-party ciphertext files;

[0125] The selection unit is used to randomly select ciphertext data located at the same position from each third ciphertext file;

[0126] The permutation unit is used to randomly permutate the ciphertext data at the same selected position to obtain multiple second ciphertext files.

[0127] Optionally, the first training module 640 may include:

[0128] The feature vectorization unit is used to vectorize the first plaintext file to obtain feature vectors.

[0129] The execution unit is used to process the feature vector sequentially through the multi-head self-attention, residual, normalization, fully connected, residual and normalization processes of the transformer model to obtain the attention hidden vector;

[0130] The prediction unit is used to predict the ciphertext of the first plaintext file based on the attention hiding vector.

[0131] The determination unit is used to determine the loss function of the transformer model based on the predicted ciphertext and multiple second ciphertext files;

[0132] The output unit is used to obtain the first data encryption model when the loss function meets the preset stopping condition;

[0133] The return unit is used to adjust the parameters of the transformer model if the loss function does not meet the preset stopping condition, and then randomly select ciphertext data from the integrated ciphertext file to obtain multiple second ciphertext files until the loss function meets the preset stopping condition, thus obtaining the first data encryption model.

[0134] Optionally, the data encryption model training device 600 may further include:

[0135] The third acquisition module is used to acquire the second plaintext file and the corresponding fourth ciphertext file;

[0136] The third training module is used to train the first data encryption model with the second plaintext file as the independent variable and the fourth ciphertext file as the dependent variable, so as to obtain the second data encryption model.

[0137] The data encryption model training device 600 provided in this application embodiment can achieve... Figures 1 to 4 The various processes implemented in the method embodiments can achieve the same technical effect, and will not be described again here to avoid repetition.

[0138] Based on the same inventive concept, this application also provides a data decryption model training device. Specifically, in conjunction with... Figure 7 Please provide a detailed explanation.

[0139] Figure 7 The diagram shows a schematic of the hardware structure of the data decryption model training device 700 provided in an embodiment of the present invention.

[0140] like Figure 7 As shown, the data decryption model training device 700 may include:

[0141] The second acquisition module 710 is used to acquire the fifth ciphertext file and the third plaintext file. The fifth ciphertext file is the ciphertext file obtained by encrypting the third plaintext file through the first data encryption model.

[0142] The second training module 720 is used to train the transformer model with the fifth ciphertext file as the independent variable and the third plaintext file as the dependent variable, so as to obtain the data decryption model.

[0143] The data decryption model training device 700 provided in this application embodiment can achieve... Figure 5 The various processes implemented in the method embodiments can achieve the same technical effect, and will not be described again here to avoid repetition.

[0144] Figure 8A schematic diagram of the hardware structure of the training device for the data encryption and decryption model provided in an embodiment of the present invention is shown.

[0145] The training device for the data encryption and decryption model may include a processor 801 and a memory 802 storing computer program instructions.

[0146] Specifically, the processor 801 may include a central processing unit (CPU), an application-specific integrated circuit (ASIC), or one or more integrated circuits that can be configured to implement embodiments of the present invention.

[0147] Memory 802 may include mass storage for data or instructions. For example, and not limitingly, memory 802 may include a hard disk drive (HDD), floppy disk drive, flash memory, optical disk, magneto-optical disk, magnetic tape, or Universal Serial Bus (USB) drive, or a combination of two or more of these. Where appropriate, memory 802 may include removable or non-removable (or fixed) media. Where appropriate, memory 802 may be internal or external to the integrated gateway disaster recovery device. In a particular embodiment, memory 802 is non-volatile solid-state memory.

[0148] In a particular embodiment, memory 802 may include read-only memory (ROM), random access memory (RAM), disk storage media device, optical storage media device, flash memory device, electrical, optical, or other physical / tangible memory storage device. Thus, typically, memory 802 includes one or more tangible (non-transitory) computer-readable storage media (e.g., memory devices) encoded with software including computer-executable instructions, and when the software is executed (e.g., by one or more processors 801), it is operable to perform the operations described with reference to the method according to one aspect of this application.

[0149] The processor 801 reads and executes computer program instructions stored in the memory 802 to implement a training device for any of the data encryption and / or decryption models in the above embodiments.

[0150] In one example, the training device for the data encryption and decryption model may further include a communication interface 803 and a bus 804. As shown in the figure, the processor 801, memory 802, and communication interface 803 are connected via the bus 804 and communicate with each other.

[0151] The communication interface 803 is mainly used to realize communication between various modules, devices, units and / or equipment in the embodiments of the present invention.

[0152] Bus 804 includes hardware, software, or both. For example, and not as a limitation, bus 804 may include an Accelerated Graphics Port (AGP) or other graphics bus, an Enhanced Industry Standard Architecture (EISA) bus, a Front Side Bus (FSB), HyperTransport (HT) interconnect, an Industry Standard Architecture (ISA) bus, a Wireless Bandwidth Interconnect, a Low Pin Count (LPC) bus, a memory bus, a Microchannel Architecture (MCA) bus, a Peripheral Control Interconnect (PCI) bus, a PCI-Express (PCI-X) bus, a Serial Advanced Technology Attachment (SATA) bus, a Video Electronics Standards Association Local (VLB) bus, or other suitable buses, or combinations of two or more of these. Where appropriate, bus 804 may include one or more buses 804. Although specific bus 804s are described and illustrated in embodiments of this application, this application contemplates any suitable bus 804 or interconnect.

[0153] The training device for this data encryption and decryption model can be based on the current training methods for data encryption and decryption models, thereby achieving a combination of... Figures 1-4 , Figure 6 The described training method and apparatus for the encryption model, and / or Figure 5 describe and Figure 7 The training method and apparatus for the decryption model are described.

[0154] In addition, this application also provides a computer program product, including computer program instructions, which, when executed by processor 801, can implement the steps and corresponding content of the aforementioned method embodiments.

[0155] It should be clarified that this application is not limited to the specific configurations and processes described above and shown in the figures. For the sake of brevity, detailed descriptions of known methods are omitted here. In the above embodiments, several specific steps are described and shown as examples. However, the method process of this application is not limited to the specific steps described and shown. Those skilled in the art can make various changes, modifications, and additions, or change the order of steps, after understanding the spirit of this application.

[0156] The functional blocks shown in the above-described structural diagram can be implemented as hardware, software, firmware, or a combination thereof. When implemented in hardware, they can be, for example, electronic circuits, application-specific integrated circuits (ASICs), appropriate firmware, plug-ins, function cards, etc. When implemented in software, the elements of this application are programs or code segments used to perform the required tasks. Programs or code segments can be stored on a machine-readable medium or transmitted over a transmission medium or communication link via data signals carried on a carrier wave. "Machine-readable medium" can include any medium capable of storing or transmitting information. Examples of machine-readable media include electronic circuits, semiconductor memory devices, ROM, flash memory, erasable ROM (EROM), floppy disks, CD-ROMs, optical disks, hard disks, fiber optic media, radio frequency (RF) links, etc. Code segments can be downloaded via computer networks such as the Internet, intranets, etc.

[0157] It should also be noted that the exemplary embodiments mentioned in this application describe methods or systems based on a series of steps or apparatus. However, this application is not limited to the order of the above steps; that is, the steps can be performed in the order mentioned in the embodiments, or in a different order, or several steps can be performed simultaneously.

[0158] The aspects of this disclosure have been described above with reference to flowchart illustrations and / or block diagrams of methods, apparatus (systems), and computer program products according to embodiments of this disclosure. It should be understood that each block in the flowchart illustrations and / or block diagrams, and combinations of blocks in the flowchart illustrations 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, or other training apparatus for a programmable data encryption and / or decryption model to produce a machine such that these instructions, executable via a processor of a computer or other programmable data processing apparatus, enable the implementation of the functions / actions specified in one or more blocks of the flowchart illustrations and / or block diagrams. Such a processor can be, but is not limited to, a general-purpose processor, a special-purpose processor, a special application processor, or a field-programmable logic circuit. It is also understood that each block in the block diagrams and / or flowcharts, and combinations of blocks in the block diagrams and / or flowcharts, can also be implemented by special-purpose hardware performing the specified functions or actions, or can be implemented by a combination of special-purpose hardware and computer instructions.

[0159] The above description is merely a specific implementation of this application. Those skilled in the art will clearly understand that, for the sake of convenience and brevity, the specific working processes of the systems, modules, and units described above can be referred to the corresponding processes in the foregoing method embodiments, and will not be repeated here. It should be understood that the protection scope of this application is not limited thereto. Any person skilled in the art can easily conceive of various equivalent modifications or substitutions within the technical scope disclosed in this application, and these modifications or substitutions should all be covered within the protection scope of this application.

Claims

1. A training method for a data encryption model, characterized in that, include: Obtain a first plaintext file and multiple first ciphertext files corresponding to the first plaintext file, each first ciphertext file having a different encryption algorithm; Multiple first-level ciphertext files are integrated to obtain a combined ciphertext file; Randomly select ciphertext data from the integrated ciphertext file to obtain multiple second ciphertext files; Using the first plaintext file as the independent variable and multiple second ciphertext files as dependent variables, train the transformer model to obtain the first data encryption model; The step of randomly selecting ciphertext data from the integrated ciphertext file to obtain multiple second ciphertext files includes: The integrated ciphertext file is split into multiple third-party ciphertext files; Each of the third ciphertext files is randomly shuffled, and ciphertext data located at the same position is randomly selected from each of the randomly shuffled third ciphertext files. The ciphertext data at the same selected positions are randomly arranged to obtain multiple second ciphertext files, each of which corresponds to a different arrangement.

2. The training method for the data encryption model as described in claim 1, characterized in that, The first plaintext file is at least one of the following: a text file, an image file, or an audio / video file.

3. The training method for the data encryption model as described in claim 1, characterized in that, The first data encryption model is obtained by training a transformer model using the first plaintext file as the independent variable and multiple second ciphertext files as dependent variables, including: The first plaintext file is vectorized to obtain a feature vector; The feature vector is processed sequentially through the multi-head self-attention, residual, normalization, fully connected, residual and normalization processes of the transformer model to obtain the attention hidden vector; Based on the attention hiding vector, predict the predicted ciphertext of the first plaintext file; Based on the predicted ciphertext and the plurality of second ciphertext files, determine the loss function of the transformer model; The first data encryption model is obtained when the loss function meets the preset stopping condition; If the loss function does not meet the preset stopping condition, the parameters of the transformer model are adjusted, and the process of randomly selecting ciphertext data from the integrated ciphertext file to obtain multiple second ciphertext files continues until the loss function meets the preset stopping condition, thus obtaining the first data encryption model.

4. The training method for the data encryption model as described in any one of claims 1-3, characterized in that, After obtaining the first data encryption model, the method further includes: Obtain the second plaintext file and the corresponding fourth ciphertext file; Using the second plaintext file as the independent variable of the first data encryption model and the fourth ciphertext file as the dependent variable of the first data encryption model, the first data encryption model is trained to obtain the second data encryption model.

5. A training method for a data decryption model, characterized in that, The method includes: Obtain a fifth ciphertext file and a third plaintext file, wherein the fifth ciphertext file is the ciphertext file obtained by encrypting the third plaintext file using a first data encryption model; the first data encryption model is obtained by the training method of the data encryption model according to any one of claims 1 to 4; Using the fifth ciphertext file as the independent variable of the transformer model and the third plaintext file as the dependent variable of the transformer model, the transformer model is trained to obtain the data decryption model.

6. A data encryption model training device, characterized in that, The device includes: The first acquisition module is used to acquire a first plaintext file and a plurality of first ciphertext files corresponding to the first plaintext file, each of which has a different encryption algorithm. The integration module is used to integrate multiple first-level ciphertext files to obtain an integrated ciphertext file. A selection module is used to randomly select ciphertext data from the integrated ciphertext file to obtain multiple second ciphertext files; the step of randomly selecting ciphertext data from the integrated ciphertext file to obtain multiple second ciphertext files includes: splitting the integrated ciphertext file into multiple third ciphertext files; randomly shuffling each of the third ciphertext files, and randomly selecting ciphertext data located at the same position from each randomly shuffled third ciphertext file; and randomly arranging the selected ciphertext data at the same position to obtain multiple second ciphertext files. The first training module is used to train a transformer model with the first plaintext file as the independent variable and multiple second ciphertext files as the dependent variable, so as to obtain the first data encryption model.

7. A training device for a data decryption model, characterized in that, The device includes: The second acquisition module is used to acquire a fifth ciphertext file and a third plaintext file, wherein the fifth ciphertext file is determined from the third plaintext file according to a first data encryption model; the first data encryption model is obtained by the training method of the data encryption model according to any one of claims 1 to 4; The second training module is used to train the transformer model using the fifth ciphertext file as the independent variable and the third plaintext file as the dependent variable, to obtain the data decryption model.

8. A training device for a model, characterized in that, The device includes: a processor and a memory storing computer program instructions; When the processor executes the computer program instructions, it implements the training method of the data encryption model as described in any one of claims 1-4 and / or the training method of the data decryption model as described in claim 5.

9. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores computer program instructions, which, when executed by a processor, implement the training method of the data encryption model as described in any one of claims 1-4 and / or the training method of the data decryption model as described in claim 5.

10. A computer program product, characterized in that, When the instructions in the computer program product are executed by the processor of the electronic device, the electronic device performs the training method of the data encryption model as described in any one of claims 1-4 and / or the training method of the data decryption model as described in claim 5.

11. A computer program product, characterized in that, When the instructions in the computer program product are executed by the processor of the electronic device, the electronic device performs the training method of the data encryption model as described in any one of claims 1-4 and / or the training method of the data decryption model as described in claim 5.

Citation Information

Patent Citations

  • Learning type digital image encryption and decryption method based on cyclic generative adversarial network

    CN112163229A

  • Data encryption and decryption method and device

    WO2012071717A1