Data encryption and decryption method, electronic device and medium

By converting plaintext data into binary format and dividing data units, and using conversion rules to replace the number of data bits, the problem of data encryption security and file size limitations in the existing technology is solved, and high-security encryption of large files is achieved.

CN117675320BActive Publication Date: 2024-10-11ROUNDTABLE KNIGHTS TECHNOLOGY CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202311629156.1
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2023-11-30
Publication Date
2024-10-11
Estimated Expiration
2043-11-30

AI Technical Summary

Technical Problem

Existing data encryption technology has risks of leakage when processing large amounts of data. In particular, the block cipher encryption method cannot effectively obfuscate the relationship between data blocks from the overall structure, causing attackers to predict plaintext information, and the file size is limited. is limited and cannot meet the needs of large files.

Method used

By converting plaintext data into a machine-readable binary format, split the data unit into a data unit with one less digit, and use conversion rules to replace the number of data digits, cut off the original data pattern, and improve data complexity and complexity through digit expansion. Security.

Benefits of technology

It significantly improves the security and complexity of data encryption, enhances the ability to support large files, greatly improves the ability to resist brute force cracking, and solves the security and file size limitations of block cipher encryption methods.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN117675320B_ABST
    Figure CN117675320B_ABST
Patent Text Reader

Abstract

The present application discloses a data encryption and decryption method, an electronic device and a medium, the encryption method comprising: obtaining plaintext data, and converting the plaintext data into binary format data, wherein the binary format data comprises a data stream consisting of a plurality of m-bit data, wherein m is a positive integer; segmenting the binary format data to obtain segmented data, wherein the segmented data comprises a plurality of m-1-bit data; obtaining a first conversion rule, wherein the first conversion rule comprises 2 m‑1 Continuous data and 2 m a mapping relationship between continuous data; converting the segmented data into first converted data according to the first conversion rule, wherein the first converted data includes a plurality of m-bit data; and generating ciphertext data according to the first conversion data.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of information security technology, and in particular to a data encryption and decryption method, electronic equipment and medium. Background Art

[0002] Data encryption is one of the important links in data security and can be applied to the storage and transmission of data in various forms such as messages, documents, and files. In data encryption, plain text can be encrypted by adding interference, conversion, and other methods.

[0003] Usually, the plain text can be encrypted in groups. In the relevant data encryption technology, there is still a high risk of leakage for large volumes of data. Summary of the invention

[0004] The present application provides a data encryption and decryption method, electronic device and medium, which can improve the security of data encryption.

[0005] The first aspect of the present application discloses a data encryption method, which is applied to an electronic device, the method comprising: obtaining plaintext data, and converting the plaintext data into binary format data, wherein the binary format data comprises a data stream composed of a plurality of m-bit data, wherein m is a positive integer; segmenting the binary format data to obtain segmented data, wherein the segmented data comprises a plurality of m-1-bit data; obtaining a first conversion rule, wherein the first conversion rule comprises 2 m-1 Continuous data and 2 m a mapping relationship between continuous data; converting the segmented data into first converted data according to the first conversion rule, wherein the first converted data includes a plurality of m-bit data; and generating ciphertext data according to the first conversion data.

[0006] In a possible implementation of the first aspect, the method further includes preprocessing the binary data, including obtaining a second conversion rule, wherein the second conversion rule includes 2 m a mapping relationship between different data in a continuous data; and converting the data in binary format into second converted data according to the second conversion rule.

[0007] In a possible implementation of the first aspect, generating ciphertext data according to the first conversion data includes obtaining a third conversion rule, wherein the third conversion rule includes 2 m a mapping relationship between different data in a continuous data; converting the first conversion data into third conversion data according to the third conversion rule; and generating the ciphertext data according to the third conversion data.

[0008] In a possible implementation of the first aspect above, converting the first conversion data into third conversion data according to the third conversion rule includes sequentially numbering each data in each data unit in the first conversion data according to the data unit; in each data unit, updating the number of each data according to the third conversion rule; and reordering each data according to the updated number to obtain the third conversion data.

[0009] In a possible implementation of the first aspect above, generating the ciphertext data according to the third conversion data includes dividing the third conversion data into multiple data units; selecting one or more data from each data unit of the multiple data units to form multiple new data units according to a predetermined rule; and combining the multiple new data units to generate the ciphertext data.

[0010] In a possible implementation of the first aspect above, m is an integer multiple of 4.

[0011] The second aspect of the present application discloses a data decryption method, which is applied to an electronic device, comprising: obtaining ciphertext data, wherein the ciphertext data is in binary format and includes a data stream consisting of a plurality of m-bit data, wherein m is a positive integer; obtaining a first conversion rule, wherein the first conversion rule includes 2 m-1 Continuous data and 2 m The invention relates to a mapping relationship between continuous data; converting the ciphertext data into segmented data according to the first conversion rule, wherein the segmented conversion data is a plurality of m-1 bit data; reorganizing the segmented data into reorganized data, wherein the reorganized data includes a plurality of m bit data; and obtaining plaintext data based on the reorganized data.

[0012] In a possible implementation of the second aspect, the method further includes obtaining a second conversion rule, wherein the second conversion rule includes 2 m A mapping relationship between different data in a continuous data; and converting the reorganized data into the plaintext data according to the second conversion rule.

[0013] In a possible implementation of the second aspect, the method further includes obtaining a third conversion rule, wherein the third conversion rule includes 2 m The mapping relationship between different data in the continuous data; generating the third data according to the ciphertext data; and converting the third converted data into the first converted data according to the third conversion rule.

[0014] In a possible implementation of the second aspect above, converting the third conversion data into the first conversion data according to the third conversion rule includes sequentially numbering each data in each data unit in the third conversion data according to the data unit; in each data unit, updating the number of each data according to the third conversion rule; and reordering each data according to the updated number to obtain the first conversion data.

[0015] The third aspect of the present application discloses an electronic device, which includes a memory storing computer-executable instructions and a processor; when the instructions are executed by the processor, the device implements the methods according to the first and second aspects of the present application.

[0016] The fourth aspect of the present application discloses a computer-readable medium, which stores one or more programs. The one or more programs can be executed by one or more processors to implement the methods of the first and second aspects of the present application.

[0017] The fifth aspect of the present application discloses a computer program product, including a computer program, characterized in that when the computer program is executed by a processor, the methods of the first and second aspects of the present application are implemented.

[0018] The data encryption and decryption method, electronic device and medium provided by the present application convert the plaintext data into a machine-readable binary format after obtaining it. The converted data stream includes multiple data units, and the length of each unit can correspond to half a byte or a byte. The data unit is re-divided into data units with one less digit by splitting the data, and then the data in the new data unit is replaced by the conversion rule, and the number of data digits therein is restored. In this way, the original data unit can cut off the original data pattern after splitting, and the data complexity and security can be improved through the conversion method of expanding the number of digits. BRIEF DESCRIPTION OF THE DRAWINGS

[0019] Figure 1 A schematic diagram of a data encryption method according to an embodiment of the present application;

[0020] Figure 2a-2b A visual schematic diagram of a first conversion rule of an embodiment of the present application;

[0021] Figure 3a-3b A visual schematic diagram of a second conversion rule of an embodiment of the present application;

[0022] Figure 4 A schematic diagram of a data encryption method according to an embodiment of the present application;

[0023] Figure 5A flowchart of a data conversion method according to an embodiment of the present application;

[0024] Figure 6 for Figure 5 A visual diagram of the data transformation method;

[0025] Figure 7 A schematic diagram of a data encryption method according to an embodiment of the present application;

[0026] Figure 8 A flowchart of a data decryption method according to an embodiment of the present application;

[0027] Fig. 9 A block diagram of an electronic device according to an embodiment of the present application. DETAILED DESCRIPTION

[0028] The present application is further described below in conjunction with specific embodiments and drawings. It is to be understood that the illustrative embodiments of the present disclosure include, but are not limited to, data encryption and decryption methods, electronic devices and media, and the specific embodiments described herein are merely for the purpose of explaining the present application, rather than limiting the present application. In addition, for ease of description, only some, but not all, structures or processes related to the present application are shown in the drawings. The acquisition, storage, use, and processing of data in the technical solution of the present application are in compliance with the relevant provisions of national laws and regulations. In order to make the purpose, technical solutions and advantages of the present application clearer, the implementation methods of the present application will be further described in detail below in conjunction with the drawings.

[0029] In the field of encryption technology, block cipher encryption is a mainstream file encryption method. Its principle is to divide the plaintext data into multiple groups and encrypt each group as a unit. This encryption process must be based on a set of fixed-length keys. Due to the limitations of the block cipher principle, the key length is related to the block size and it is difficult to further improve. Therefore, the security level of block ciphers in a general sense (or encryption strength) is the length of the key. The current maximum key length is 256 bits. Although it is recognized as safe, with the advent of the post-quantum computer era, the demand for higher encryption security levels will become more and more urgent.

[0030] Take the AES algorithm, the most representative block cipher, for example. It groups plaintext into independent fixed-length data blocks (usually 128 or 256 bits), and then encrypts each data block independently. Although encryption of the data block itself is generally recognized as safe, this encryption method cannot confuse the relationship between data blocks from the overall structure, and some features of the original plaintext will be retained. As a result, attackers can obtain some plaintext information from the ciphertext, or even predict the plaintext.

[0031] Therefore, in practical applications, block cipher algorithms need to be implemented in combination with various modes. Currently, the most commonly used mode is AES-GCM, which can effectively solve the problem of obfuscating data from the overall structure. However, due to algorithmic security reasons, this mode has strict restrictions on the size of plaintext files, that is, it cannot exceed 2 32 Bytes, about 4.29GB. As time goes by, the file sizes of various formats continue to expand, and this problem will become more and more significant.

[0032] In order to solve the above problems, further improve the encryption strength, obfuscate the overall file structure, and make the encrypted file size unlimited, an embodiment of the present application provides a data encryption method: after obtaining the plaintext data, convert it into a machine-readable binary format, split the data unit into data units with one less bit by splitting the data, and then replace the data in the new data unit by the conversion rule, and restore the number of data bits. The original data unit can be cut off from the original data pattern after splitting, and the data complexity and security can be greatly improved through the conversion of bit expansion.

[0033] The following combination Figure 1 , the details of the embodiment of the data encryption method according to the present application are described. Figure 1 As shown, a data encryption method 100 according to an implementation of the present application includes the following steps.

[0034] In S101, plaintext data is acquired and converted into data in binary format, where the data in binary format includes a data stream consisting of a plurality of m-bit data.

[0035] The method 100 is applied to an electronic device, which may be one or more of a desktop computer, a laptop computer, a smart phone, a tablet computer, a server, an IoT device, a chip, or a portable wearable device. The IoT device may be one or more of a smart vehicle device, a smart TV, a smart speaker, or a smart air conditioner. In some embodiments, an application may be installed in the electronic device, and the application may include one or more of an application pre-set in the operating system, an application that needs to be installed separately, and a program application that can be used without installation.

[0036] In some examples, the form of plaintext data includes, but is not limited to, one or more of characters, documents, images, audio, and video. The plaintext data is converted into data in binary format for machine readable. Any encoding specification can be used to encode the plaintext data. In some examples, the encoding specification includes, but is not limited to, any of ASCII (American Standard Code for Information Interchange) code, Unicode (Unicode) encoding, and UTF-8. For example, if the plaintext data includes characters, each character can be converted into corresponding binary data according to ASCII; if the plaintext data includes pictures, the pixel value of each pixel can be converted into binary data format.

[0037] The converted binary data includes a plurality of m-bit data streams, where m is a positive integer. For example, each letter in the word "knight" undergoes binary conversion, and the letter "k" is converted to "0110 1011", the letter "n" is converted to "01101110", the letter "i" is converted to "0110 1001", the letter "g" is converted to "0110 0111", the letter "h" is converted to "01101000", and the letter "t" is converted to "0111 0100". In this example, each letter corresponds to a length of 1 byte (8 bits). In this way, the word "knight" is converted into a data stream "0110 1011 0110 1110 0110 1001 0110 011101101000 0111 0100". In some examples, m is an integer multiple of 4, for example, the word "knight" is converted to include 12 4-bit data streams, or 6 8-bit data streams.

[0038] In S102, the data in binary format is segmented to obtain segmented data, wherein the segmented data includes a plurality of m-1-bit data.

[0039] The multiple m-bit data obtained in S101 are divided into multiple m-1-bit data in sequence. For example, referring to Table 1, the 12 4-bit data streams in the above example can be divided into 16 3-bit data streams. That is, the above data stream "" is sequentially and continuously converted into "011 010 110 110 111 001 101 001 011 001 110 110 100 001 110100" in units of 3. This division can cut off the original data pattern.

[0040] Table 1 Segmentation data example 1

[0041]

[0042] In the above example, 12 4-bit data streams can be exactly divided into 16 3-bit data streams. If the length of the divided data stream cannot be divided by 3, the last unit of data can be padded in a predetermined manner. In some examples, the last unit of data can be padded with 0. For example, if the last unit of the divided data stream is "10" or "1", they can be padded with "010" or "001".

[0043] Table 2 Segmentation data example 2

[0044]

[0045] For example, in the example of S101, the word "knight" is converted into a data stream including six 8 bits, namely "0110101101101110 01101001 01100111 01101000 01110100". Referring to Table 2, the six 8-bit data streams can be converted into multiple 7-bit data streams "0110101 1011011 1001101 0010110 0111011 0100001110100", wherein the "110100" in the last unit can be padded to "0110100".

[0046] In S103, a first conversion rule is obtained, wherein the first conversion rule includes 2 m-1 Continuous data and 2 m The mapping relationship of continuous data.

[0047] In the first conversion rule, include 2 m-1 Continuous data and 2 m The mapping relationship of continuous data. That is, 2 m -1 The different data correspond to 2 m 2 of the data m-1 For example, the data unit after segmentation in S102 is m-1 bits of data, corresponding to 2 m-1 Using the first conversion rule, the possible 2 m-1 Replace the data with 2 m 2 random ones from the data m-1 possible data.

[0048] Table 3 Example of the first conversion rule

[0049]

[0050] Table 3 shows an example of the first conversion rule, which converts the numbers 0–(2 m-1-1) is mapped to the data numbered 0–(2 m -1) data. In Table 3, m=4, and the data unit after segmentation is 3-bit data, corresponding to 2 3 In Table 3, 8 data are replaced by 8 random data out of 16 data. For the sake of clarity, the converted data is expressed in hexadecimal. For better explanation, Figure 2a A visualization example of the first conversion rule in Table 3 of the present application is shown. Figure 2a A 4×4 grid of 16 small squares is shown, where each small square is represented by a hexadecimal number from 0 to F. The first conversion rule is equivalent to randomly selecting 8 small squares (gray background) from the 16 small squares and randomly numbering the 8 small squares from 0 to 7 (see the lower right corner mark). Figure 2a The first conversion rule in is only an example. It can be understood that the first conversion rule can be randomly generated, and the possibility of the first conversion rule is 16! / (16-8)!.

[0051] When m=8, the first conversion rule is to convert 2 7 The different data correspond to 2 8 2 of the data 7 different data. Figure 2b Another visualization example of the first transformation rule of the present application is shown.

[0052] Figure 2b A 16×16 grid of 256 small squares is shown in FIG. 1 , where each small square is represented by a hexadecimal number from 0 to FF. The first conversion rule is equivalent to randomly selecting 128 small squares (gray background) from the 256 small squares and randomly numbering the 128 small squares (see the corner mark in the lower right corner). Figure 2b The first conversion rule in is only an example. It can be understood that the first conversion rule can be randomly generated, and the possibility of the first conversion rule is 256! / (256-128)!.

[0053] In S104 , the segmented data is converted into first converted data according to a first conversion rule, wherein the first converted data includes a plurality of m-bit data.

[0054] The segmented data obtained in S102 can be converted into first converted data according to the first conversion rule in S103. Although each data unit in the segmented data includes m-1 bits of data, after replacement by the first conversion rule, each data unit includes m bits of data.

[0055] By converting the m-1 bits to m bits in the data unit, the data possibilities of each data unit are increased from 2 m-1 Expand to 2m For example, when m=4, the possibility of each data unit expands from 8 to 16, so that additional data information is mixed into the original data. This additional data information has nothing to do with the plaintext data but can improve the encryption protection of the data.

[0056] In addition, regarding the replacement of each data unit, the possibility of replacement ranges from (2 m-1 )! Increase to (2 m )! / (2 m -2 m-1 )! , greatly increasing the complexity of the replacement. For example, when m=4, the data possibilities of each data unit increase from 8! (40320) to 16! / (16-8)! (518918400).

[0057] In S105 , ciphertext data is generated according to the first converted data.

[0058] Through the conversion, segmentation and replacement of S101-S104, the plaintext data is converted into ciphertext data. It can be understood that the steps in method 100 are not limited to be performed in the order of the numbers.

[0059] In method 100, after obtaining the plaintext data, it is converted into a machine-readable binary format, and the converted data stream includes multiple data units, and the length of each unit can correspond to half a byte or a byte. The data unit is re-divided into data units with one less bit by splitting the data. Then, the data in the new data unit is replaced by the conversion rule, and the number of data bits therein is restored. In this way, the original data unit can cut off the original data pattern after splitting, and the data complexity and security can be greatly improved through the conversion of the bit expansion.

[0060] In some implementations, the encryption method of the present application can also pre-process the data in binary format. The pre-processing process includes replacing the data before segmentation according to a predetermined rule.

[0061] The predetermined rules in the preprocessing, namely the second conversion rules, include 2 m Continuous data and 2 m The mapping relationship of continuous data includes 2 m The mapping relationship between different data in continuous data. m The different data correspond to 2 m Using the second conversion rule, the possible 2 m In other words, each data is replaced internally in the second conversion rule.

[0062] Table 4 Example of the second conversion rule

[0063]

[0064] Table 4 shows an example of the second conversion rule. m -1) is mapped to the data numbered 0–(2 m -1) data. In Table 4, m=4, which means that 16 data are internally replaced.

[0065] To better illustrate, Figure 3a A visualization example of the second conversion rule in Table 4 of the present application is shown. Figure 3a A 4×4 grid of 16 small squares is shown, where each small square is represented by a hexadecimal number from 0 to F. The second conversion rule is equivalent to selecting all the 16 small squares (gray background) and randomly numbering them from 0 to F (see the lower right corner mark). Figure 3a The second conversion rule in is only an example. It can be understood that the second conversion rule can be randomly generated, and the possibility of the second conversion rule is 16! .

[0066] When m=4, for the pre-processed encryption process, that is, after the first conversion rule and the second conversion rule, in the case of brute force cracking, it is necessary to exhaustively enumerate (16! / (16-8)!)×16!≈2 73 Second-rate.

[0067] Figure 3b A visualization example of the second conversion rule according to an embodiment of the present application is shown. Figure 3b A 16×16 grid of 256 small squares is shown in FIG. 1 , where each small square is represented by a hexadecimal number from 0 to FF. The second conversion rule is equivalent to selecting all the 256 small squares (gray background) and randomly numbering them from 0 to FF (see the lower right corner mark). Figure 3b In the case of m=8, the second conversion rule is to convert 2 8 Different data internal permutations, the possibility of the second conversion rule is 256! . Similarly, for the processing of the first conversion rule and the second conversion rule, in the case of brute force cracking, it is necessary to exhaustively enumerate (256! / (256-128)!) × 256! ≈ 2 2656 Second-rate.

[0068] Therefore, the encryption process encrypts the entire plaintext data rather than encrypting each data block. The preprocessing process can not only cut off the specific mathematical relationship between the plaintext data and the ciphertext data, but also greatly improve the ability to resist brute force cracking.

[0069] In some implementations, generating ciphertext data according to the first conversion data may include performing a permutation process on the first conversion data according to a predetermined conversion rule. This process may be similar to the above-mentioned preprocessing process. That is, the permutation process of the first conversion data may include the following steps: obtaining a third conversion rule, wherein the third conversion rule includes 2 m The mapping relationship between different data in the continuous data; converting the first conversion data into third conversion data according to a third conversion rule; and generating ciphertext data according to the third conversion data.

[0070] Figure 4 A schematic diagram of a data encryption method 200 according to an embodiment of the present application is shown. Figure 5 Detailed instructions are given for each step in the chapter.

[0071] In S201, plain text data is acquired and converted into data in binary format.

[0072] It can be understood that this step is similar to S101 and will not be described in detail here.

[0073] In S202, pre-processing is performed according to a second conversion rule.

[0074] The converted binary data can be Figure 3a As well as the example of Table 4, internal permutation is performed on it according to the second conversion rule.

[0075] In S203, the data is segmented and first converted data is obtained according to a first conversion rule.

[0076] For the preprocessed data, the data unit may be segmented by one less bit according to S102 - S103 , and then the segmented data may be replaced according to the first conversion rule to obtain first converted data.

[0077] In S204, the first converted data is converted into third converted data according to a third conversion rule.

[0078] For the first conversion data, a processing method similar to that in S202 can be used to internally replace the first conversion data with the third conversion data. The third conversion rule can be randomly generated with reference to the example in Table 4. In some examples, the third conversion rule can be the same as the second conversion rule to improve data security and data encryption efficiency. In some examples, the third conversion rule can be different from the second conversion rule, which can greatly improve the ability to resist brute force cracking.

[0079] In S205, ciphertext data is generated according to the third converted data.

[0080] In some implementations, the third converted data may be directly used as ciphertext data. In some other implementations, the third converted data may be rearranged to generate ciphertext data.

[0081] In method 200, the plaintext data is pre-processed and replaced, the data is segmented and replaced, and the data is re-ordered, which can greatly improve the security of the data.

[0082] Figure 5 The flowchart of a data conversion method 300 according to an embodiment of the present application is shown. The method 300 includes the following steps.

[0083] In S301, each data in each data unit is numbered in sequence according to the data unit in the first conversion data.

[0084] In the first replacement data, it is divided according to the data unit. For example, as mentioned above, the first replacement data includes a plurality of m-bit data, which can be 2 n m bits of data is a data unit, where n is a positive integer. The specific values ​​of m and n can be determined as needed, and the values ​​of m and n can be equal or different. For example, m = 4, n = 3 or 4; m = 8, n = any one of 3, 4, 7, 8. The data in each data unit is numbered in sequence, for example, in each data unit, it can be numbered 0-(2 n -1).

[0085] In S302, in each data unit, the serial number of each data is updated according to the third conversion rule.

[0086] In the third conversion rule, since it includes 2 m If a mapping relationship between continuous data is established, the serial number of each data can be converted according to the third conversion rule to obtain an updated serial number.

[0087] In S303, each data is reordered according to the updated serial number.

[0088] Reorder each data according to its updated number.

[0089] Figure 6 Shows Figure 5 A visual diagram of the method 300 in FIG. Figure 6 In the data stream, the first replacement data is "11100110...0000...". Figure 6 (a) shows the nThe first replacement data is divided into a plurality of data units, where n=4. In the first data unit, "1110 0110 ... 0000" is numbered from 0 to F in sequence. Similarly, the subsequent data units are numbered in a similar manner.

[0090] Figure 6 The third conversion rule in refers to Figure 3a (Table 4) Figure 3a , the data originally numbered 0 is updated to F. Figure 3a The index in , according to the subscript 0, directly determines the updated F. For other numbers, you can also use the subscript to index to the updated value.

[0091] exist Figure 6 In (b), the updated numbers are re-sorted from 0 to F, and the generated data stream is "11011000...1110...". Figure 6 It can be seen that after the positions of the multiple m-bit data of the first replacement data are converted according to the third conversion rule, the complexity of the ciphertext data can be increased.

[0092] Figure 7 A schematic flow chart of a data encryption method 400 according to an embodiment of the present application is shown.

[0093] In S401 , the third converted data is divided into a plurality of data units.

[0094] Reference Figure 6 In the example (b), the rearranged data, i.e., the third transformed data "1101 1000 ... 1110 ...", can be divided into multiple data units. For example, in units of 8 or 16, it can be divided into multiple data units consisting of 16 4-bit data in sequence.

[0095] In S402, one or more data are selected from each data unit of the plurality of data units according to a predetermined rule to form a plurality of new data units.

[0096] exist Figure 6 In (b), the data with the same number in each data unit can be selected, such as the data with number 0 in the first, second, third, etc. Or the data with adjacent numbers in each data unit can be selected, such as the data with numbers 0 and 1 in the first, second, third, etc. The present application does not limit the method for selecting data in the data unit, and various other methods can be used for selection. And so on, until all the data in the data unit are selected to form multiple new data units.

[0097] In S403, multiple new data units are combined to generate ciphertext data.

[0098] New data units are combined to generate ciphertext data. For example, Figure 6 The ciphertext data in (b) may be generated from left to right in the order of rows. The present application does not limit the combination method in the data unit, and various other combinations may be used.

[0099] The present application also discloses a data decryption method 500, corresponding to the encryption method 100, now refer to Figure 8 Give instructions.

[0100] In S501, ciphertext data is obtained, where the ciphertext data is in binary format and includes a data stream consisting of a plurality of m-bit data, where m is a positive integer.

[0101] In S502, a first conversion rule is obtained, wherein the first conversion rule includes 2 m-1 Continuous data and 2 m The mapping relationship of continuous data.

[0102] In S503, the ciphertext data is converted into segmented data according to a first conversion rule, wherein the segmented converted data is a plurality of m-1-bit data.

[0103] In S504, the segmented data is reorganized into reorganized data, wherein the reorganized data includes a plurality of m-bit data.

[0104] At S505, plaintext data is obtained based on the reorganized data.

[0105] It can be understood that method 500 and method 100 are reversible to each other, and each step in method 500 is a reverse step of each step in method 100, which is illustrated below with examples.

[0106] When the method 100 includes a preprocessing step, the method 500 further includes: obtaining a second conversion rule, wherein the second conversion rule includes 2 m mapping relationship between different data in the continuous data; and converting the reorganized data into plain text data according to the second conversion rule.

[0107] In some embodiments, when generating ciphertext data according to the first conversion data in method 100 includes performing a permutation process on the first conversion data according to a predetermined conversion rule, method 500 may further include the following steps: obtaining a third conversion rule, wherein the third conversion rule includes 2 m generating third data according to the ciphertext data; and converting the third converted data into the first converted data according to the third conversion rule.

[0108] In some embodiments, when method 100 includes reordering the first replacement data, method 500 may further include the following steps: sequentially numbering each data in each data unit according to the data unit in the third conversion data; updating the number of each data in each data unit according to the third conversion rule; and reordering each data according to the updated number to obtain the first conversion data.

[0109] It is understandable that method 500 may also include the reverse steps of other steps in method 100, which will not be described in detail here.

[0110] Reference now Fig. 9 , Fig. 9 6 is a block diagram of an electronic device 600 according to an embodiment of the present application. The electronic device 600 may include one or more processors 602, a system control logic 608 connected to at least one of the processors 602, a system memory 604 connected to the system control logic 608, a non-volatile memory (NVM) 606 connected to the system control logic 608, and a network interface 610 connected to the system control logic 608.

[0111] The processor 602 may include one or more single-core or multi-core processors. The processor 602 may include any combination of general-purpose processors and special-purpose processors (e.g., graphics processors, application processors, baseband processors, etc.). In the embodiments of the present invention, the processor 602 may be configured to execute the following operations: Figure 1-8 One or more of the various embodiments shown.

[0112] In some embodiments, system control logic 608 may include any suitable interface controller to provide any suitable interface to at least one of processors 602 and / or any suitable device or component in communication with system control logic 608 .

[0113] In some embodiments, the system control logic 608 may include one or more memory controllers to provide an interface to the system memory 604. The system memory 604 may be used to load and store data and / or instructions. In some embodiments, the memory 604 of the device 600 may include any suitable volatile memory, such as a suitable dynamic random access memory (DRAM).

[0114] NVM / memory 606 may include one or more tangible, non-transitory computer-readable media for storing data and / or instructions. In some embodiments, NVM / memory 606 may include any suitable non-volatile memory such as flash memory and / or any suitable non-volatile storage device, such as at least one of a HDD (Hard Disk Drive), a CD (Compact Disc) drive, and a DVD (Digital Versatile Disc) drive.

[0115] NVM / storage 606 may include a portion of storage resources installed on a device of apparatus 600, or it may be accessible to the apparatus but not necessarily a part of the apparatus. For example, NVM / storage 606 may be accessed over a network via network interface 610.

[0116] In particular, system memory 604 and NVM / storage 606 may include, respectively, a temporary copy and a permanent copy of instructions 620. Instructions 620 may include instructions that, when executed by at least one of processors 602, cause device 600 to perform the following operations: Figure 1 , 4 In some embodiments, the instructions 620 , hardware, firmware and / or software components thereof may be additionally / alternatively placed in the system control logic 608 , the network interface 610 and / or the processor 602 .

[0117] In one embodiment, at least one of the processors 602 may be packaged together with logic for one or more controllers of the system control logic 608 to form a system in package (SiP). In one embodiment, at least one of the processors 602 may be integrated on the same die with logic for one or more controllers of the system control logic 608 to form a system on chip (SoC).

[0118] Each method implementation mode of the present application can be implemented in the form of software, magnetic components, firmware, etc.

[0119] Program code can be applied to input instructions to perform the functions described herein and generate output information. The output information can be applied to one or more output devices in a known manner. For purposes of this application, a processing system includes any system having a processor such as, for example, a digital signal processor (DSP), a microcontroller, an application specific integrated circuit (ASIC), or a microprocessor.

[0120] Program code can be implemented with high-level programming language or object-oriented programming language to communicate with the processing system. When necessary, program code can also be implemented with assembly language or machine language. In fact, the mechanism described herein is not limited to the scope of any specific programming language. In either case, the language can be a compiled language or an interpreted language.

[0121] One or more aspects of at least one embodiment may be implemented by representative instructions stored on a computer-readable storage medium, which represent various logic in a processor, and when the instructions are read by a machine, cause the machine to fabricate logic for performing the techniques described herein. These representations, known as "IP cores," may be stored on a tangible computer-readable storage medium and supplied to multiple customers or manufacturing facilities to load into a manufacturing machine that actually manufactures the logic or processor.

[0122] An embodiment of the present application discloses a computer-readable medium storing one or more programs executable by one or more processors to implement the method of the present application.

[0123] An embodiment of the present application discloses a computer program product, including a computer program, which implements the method of the present application when executed by a processor.

[0124] The above is a description of the implementation mode of the present application by specific specific embodiments, and those skilled in the art can easily understand other advantages and effects of the present application from the contents disclosed in this specification. Although the description of the present application will be introduced in conjunction with the preferred embodiment, this does not mean that the features of this invention are limited to the implementation mode. In order to provide a deep understanding of the present application, many specific details are included in the above description. The present application can also be implemented without using these details. In addition, in order to avoid confusion or blurring the focus of the present application, some specific details will be omitted in the description. It should be noted that the embodiments in the present application and the features in the embodiments can be combined with each other without conflict.

[0125] Furthermore, various operations will be described as multiple discrete operations in a manner that is most helpful for understanding the illustrative embodiments; however, the order of description should not be construed as implying that these operations are necessarily order dependent. In particular, these operations do not need to be performed in the order presented.

[0126] Unless the context dictates otherwise, the terms "comprising," "having," and "including" are synonymous. The phrase "A / B" means "A or B." The phrase "A and / or B" means "(A and B) or (A or B)."

[0127] In some cases, the disclosed embodiments may be implemented in hardware, firmware, software, or any combination thereof. The disclosed embodiments may also be implemented as instructions carried or stored on one or more temporary or non-temporary machine-readable (e.g., computer-readable) storage media, which may be read and executed by one or more processors. For example, instructions may be distributed over a network or through other computer-readable media. Therefore, machine-readable media may include any mechanism for storing or transmitting information in a machine (e.g., computer) readable form. Therefore, machine-readable media include any type of machine-readable media suitable for storing or transmitting electronic instructions or information in a machine (e.g., computer) readable form.

[0128] It should be understood that although the terms "first", "second", etc. may be used here to describe various units or data, these units or data should not be limited by these terms. These terms are used only to distinguish one feature from another. It should be noted that in this specification, similar numbers and letters represent similar items in the following drawings, so once an item is defined in one drawing, it does not need to be further defined and explained in the subsequent drawings.

[0129] While the present invention has been shown and described with reference to certain preferred embodiments thereof, it will be understood by those skilled in the art that various changes in form and details may be made therein without departing from the spirit and scope of the invention.

Claims

1. A data encryption method, applied to electronic equipment, characterized in that: The method comprises, Obtaining plaintext data, and converting the plaintext data into data in binary format, wherein the data in binary format includes a data stream consisting of a plurality of m-bit data, where m is a positive integer; Segmenting the binary format data to obtain segmented data, wherein the segmented data includes a plurality of m-1-bit data; Obtain a first conversion rule, wherein the first conversion rule includes 2 m-1 Continuous data and 2 m The mapping relationship of continuous data; converting the segmented data into first converted data according to the first conversion rule, wherein the first converted data includes a plurality of m-bit data; as well as Obtain a second conversion rule, wherein the second conversion rule includes 2 m The mapping relationship between different data in continuous data; Divide the first conversion data into multiple pieces of length 2 m Columns; Number each data in each of the columns in sequence; In each of the columns, updating the serial number of each of the data according to the second conversion rule; Reorder each data according to the updated serial number to obtain third converted data; dividing the third converted data into a plurality of data units; Selecting one or more data from each of the plurality of data units according to a predetermined rule to form a plurality of new data units; as well as The multiple new data units are combined to generate ciphertext data.

2. The method according to claim 1, characterized in that It also includes preprocessing the data in binary format, including: The data in binary format is converted into second converted data according to the second conversion rule.

3. The method according to claim 1, characterized in that m is an integer multiple of 4.

4. A data decryption method, applied to an electronic device, characterized in that: include, Acquire ciphertext data, wherein the ciphertext data is in binary format and includes a data stream consisting of a plurality of m-bit data, wherein m is a positive integer; Obtain a first conversion rule, wherein the first conversion rule includes 2 m-1 Continuous data and 2 m The mapping relationship of continuous data; Obtain a second conversion rule, wherein the second conversion rule includes 2 m The mapping relationship between different data in continuous data; Generate third conversion data according to the ciphertext data; The third conversion data is divided into a plurality of pieces of length 2 m Columns; Number each data in each of the columns in sequence; In each of the columns, updating the serial number of each of the data according to the second conversion rule; Reorder each data according to the updated serial number to obtain first converted data; Converting the first converted data into segmented data according to the first conversion rule, wherein the segmented data is a plurality of m-1-bit data; reorganizing the segmented data into reorganized data, wherein the reorganized data includes a plurality of m-bit data; as well as Plaintext data is obtained based on the reorganized data.

5. The method according to claim 4, characterized in that Also includes, The reorganized data is converted into the plaintext data according to the second conversion rule.

6. An electronic device, characterized in that: The device comprises a memory storing computer executable instructions and a processor; when the instructions are executed by the processor, the device implements the method according to any one of claims 1 to 5.

7. A computer-readable storage medium, characterized in that: The storage medium stores one or more programs, and the one or more programs are executed by one or more processors to implement the method according to any one of claims 1 to 5.

8. A computer program product, characterized in that The method comprises a computer program, wherein when the computer program is executed by a processor, the method according to any one of claims 1 to 5 is implemented.