DATA ENCRYPTION METHOD, DATA DECRYPTION METHOD, ELECTRONIC DEVICE AND STORAGE MEDIA

RU2026120246APending Publication Date: 2026-09-02РАУНДТЕЙБЛ НАЙТС ТЕКНОЛОДЖИ КО ЛТД
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
RU2026120246
Authority / Receiving Office
RU · RU
Patent Type
Applications
Current Assignee / Owner
Priority Date
2023-11-30
Filing Date
2024-10-29
Publication Date
2026-09-02

AI Technical Summary

Technical Problem

The existing data encryption technology poses a risk of leakage when processing larger volumes of data, and the security level of packet password encryption is limited by the key length and chunk size, which is difficult to further improve, and the file size is limited.

Method used

By converting plaintext data into binary format and dividing it into data units with less than one digit, and then replacing the data through conversion rules to generate ciphertext data. The method includes obtaining plaintext data, converting it into binary format, segmenting data, and applying conversion rules to generate ciphertext data.

Benefits of technology

This method can cut off the original data mode, improve data complexity and security through bit expansion, significantly improve encryption strength, and no file size limitations.

✦ Generated by Eureka AI based on patent content.
Patent Text Reader

Abstract

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

Description

Data encryption and decryption method, electronic device and medium 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 a crucial aspect of data security and can be applied to the storage and transmission of data in various forms, including messages, documents, and files. Data encryption can be performed using various methods, such as adding interference and transforming data.

[0003] Generally, plain text can be encrypted in groups. In related data encryption technologies, there is still a high risk of leakage for large amounts of data.

[0004] Summary of the Invention

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

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

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

[0008] 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 The mapping relationship between different data in the 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.

[0009] 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 according to the data unit in the first 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 third conversion data.

[0010] In a possible implementation of the first aspect above, generating the ciphertext data based on 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.

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

[0012] 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 multiple m-bit data, where m is a positive integer; obtaining a first conversion rule, wherein the first conversion rule includes 2 m-1 Continuous data and 2 m 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.

[0013] 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 mapping relationship between different data in the continuous data; and converting the reorganized data into the plaintext data according to the second conversion rule.

[0014] 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 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.

[0015] 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.

[0016] 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.

[0017] 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.

[0018] The fifth aspect of the present application discloses a computer program product, comprising 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.

[0019] The data encryption and decryption method, electronic device, and medium provided by the present application convert 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. By splitting the data, the data unit is re-divided into data units with one less bit, and 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 be cut off from the original data pattern after splitting, and the data complexity and security can be improved through the conversion method of expanding the number of bits. BRIEF DESCRIPTION OF THE DRAWINGS

[0020] FIG1 is a schematic diagram of a flow chart of a data encryption method according to an embodiment of the present application;

[0021] 2a-2b are schematic visualization diagrams of a first conversion rule according to an embodiment of the present application;

[0022] 3a-3b are schematic visualization diagrams of a second conversion rule according to an embodiment of the present application;

[0023] FIG4 is a schematic diagram of a flow chart of a data encryption method according to an embodiment of the present application;

[0024] FIG5 is a flow chart of a data conversion method according to an embodiment of the present application;

[0025] FIG6 is a visualization diagram of the data conversion method of FIG5 ;

[0026] FIG7 is a flow chart of a data encryption method according to an embodiment of the present application;

[0027] FIG8 is a flow chart of a data decryption method according to an embodiment of the present application;

[0028] FIG9 is a block diagram of an electronic device according to an embodiment of the present application. DETAILED DESCRIPTION

[0029] The present application will be further described below in conjunction with specific embodiments and accompanying drawings. It will 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, not for 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 accompanying drawings. The acquisition, storage, use, processing, etc. of data in the technical solution of the present application comply 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 accompanying drawings.

[0030] In the field of encryption technology, block ciphers are a mainstream file encryption method. Their principle is to divide plaintext data into multiple blocks and encrypt each block as a unit. This encryption process is based on a fixed-length key. Due to the limitations of block ciphers, the key length is linked to the block size, making it difficult to further improve. Therefore, the security level (or encryption strength) of a block cipher is generally measured by the key length. The current maximum key length is 256 bits, which is generally recognized as secure. However, with the advent of the post-quantum computing era, the demand for higher encryption security levels will become increasingly urgent.

[0031] For example, the AES algorithm, a leading block cipher, groups plaintext into independent fixed-length blocks (typically 128 or 256 bits), then encrypts each block independently. While encryption of the data blocks themselves is generally considered secure, this encryption method fails to obfuscate the overall structure of the blocks, preserving certain characteristics of the original plaintext. This can allow attackers to extract information about the plaintext from the ciphertext, or even predict the plaintext.

[0032] Therefore, in practical applications, block cipher algorithms need to be implemented in 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 232 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.

[0033] To address the above-mentioned issues, further enhance 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 plaintext data, convert it into a machine-readable binary format, split the data to re-divide the data unit into data units with one less bit, and then replace the data in the new data unit according to the conversion rules, and restore the number of bits therein. The original data unit can be cut off after splitting, and the data complexity and security can be greatly improved through the conversion of bit expansion.

[0034] The following describes details of an embodiment of a data encryption method according to the present application in conjunction with Figure 1. As shown in Figure 1, a data encryption method 100 according to an embodiment of the present application includes the following steps.

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

[0036] Method 100 is applied to an electronic device, which may be one or more of a desktop computer, a laptop computer, a smartphone, 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 car device, a smart TV, a smart speaker, or a smart air conditioner. In some embodiments, the electronic device may have installed applications, including one or more of applications pre-installed in the operating system, applications that require separate installation, and applications that can be used without installation.

[0037] In some examples, the form of the 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 reading. 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), Unicode, 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 an image, the pixel value of each pixel can be converted into binary data format.

[0038] The converted binary data includes multiple m-bit data streams, where m is a positive integer. For example, the letters in the word "knight" undergo binary conversion: the letter "k" becomes "0110 1011," the letter "n" becomes "01101110," the letter "i" becomes "0110 1001," the letter "g" becomes "0110 0111," the letter "h" becomes "01101000," and the letter "t" becomes "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 the data stream "0110 1011 0110 1110 0110 1001 0110 0111 01101000 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.

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

[0040] The multiple m-bit data obtained in S101 are sequentially divided into multiple m-1-bit data. 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 converted to "011 010 110 110 111 001 101 001 011 001 110 110 100 001 110 100" in units of 3. This division can interrupt the original data pattern.

[0041] Table 1 Segmentation data example 1

[0042] In the example above, the 12 4-bit data streams can be split into 16 3-bit data streams. If the length of the split data stream is not divisible 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 leading zeros. For example, if the last unit of the split data stream is "10" or "1", they can be padded with "010" or "001".

[0043] Table 2 Segmentation data example 2

[0044] For example, in the example of S101, the word "knight" is converted into a data stream consisting of six 8-bit 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 0100001 110100", where the last unit "110100" can be padded to "0110100".

[0045] 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.

[0046] 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 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 The first conversion rule can be used to convert the possible 2 m-1 Replace the data with 2 m 2 random ones in the data m-1 Possible data.

[0047] Table 3 Example of the first conversion rule

[0048] 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 division is 3-bit data, corresponding to 2 3The probability of data. In Table 3, 8 data are replaced by 8 random data out of 16 data. For clarity, the converted data is expressed in hexadecimal. For better explanation, Figure 2a shows a visual example of the first conversion rule in Table 3 of the present application. Figure 2a shows a 4×4 grid consisting of 16 small squares, each of which is represented by a hexadecimal number from 0 to F. The first conversion rule can be equivalent to randomly selecting 8 small squares from these 16 small squares (gray background) and randomly numbering these 8 small squares from 0 to 7 (see the subscript on the lower right). The first conversion rule in Figure 2a is only an example. It can be understood that the first conversion rule can be randomly generated, and the probability of the first conversion rule is 16! / (16-8)! .

[0049] When m=8, the first conversion rule is to convert 2 7 Different data correspond to 2 8 2 of the data 7 FIG2 b shows another visualization example of the first conversion rule of the present application.

[0050] Figure 2b shows a 16×16 grid consisting of 256 small squares, each represented by a hexadecimal number from 0 to FF. The first conversion rule is equivalent to randomly selecting 128 small squares from these 256 small squares (gray background) and randomly numbering these 128 small squares (see the superscript in the lower right corner). The first conversion rule in Figure 2b is merely an example; it is understood that the first conversion rule can be randomly generated, with a probability of 256! / (256-128)!.

[0051] 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.

[0052] 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.

[0053] 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 2 m For example, when m=4, the possibilities of each data unit expand 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.

[0054] In addition, regarding the replacement of each data unit, the possibility of replacement ranges from (2m-1 )! Grow 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).

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

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

[0057] In method 100, after obtaining plaintext data, it is converted into a machine-readable binary format. The converted data stream includes multiple data units, each of which can correspond to a half-byte or a full byte in length. Data is segmented to re-divide the data units into data units with one less bit. Then, the data within the new data units is replaced using a conversion rule, restoring the number of bits. In this way, the segmentation of the original data units can disrupt the original data pattern, and the conversion through bit expansion can significantly improve data complexity and security.

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

[0059] 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 a continuous data. m Different data correspond to 2 m Using the second conversion rule, the possible 2 m In other words, each data is internally replaced in the second conversion rule.

[0060] Table 4 Example of the second conversion rule

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

[0062] For better illustration, Figure 3a shows a visualization of the second conversion rule in Table 4 of this application. Figure 3a shows a 4×4 grid of 16 small squares, each of which is represented by a hexadecimal number from 0 to F. The second conversion rule is equivalent to selecting all 16 small squares (gray background) and randomly numbering them from 0 to F (see the superscript in the lower right corner). The second conversion rule in Figure 3a is merely an example; it is understood that the second conversion rule can be randomly generated, with a probability of 16!

[0063] When m=4, for the pre-processed encryption process, that is, after 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 (16! / (16-8)!)×16!≈2 73 Second-rate.

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

[0065] Therefore, the encryption process encrypts the entire plaintext data, rather than encrypting individual data blocks. The preprocessing process not only breaks the specific mathematical relationship between the plaintext data and the ciphertext data, but also significantly improves the ability to resist brute force attacks.

[0066] In some embodiments, generating ciphertext data based on 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 the third conversion rule; and generating ciphertext data according to the third conversion data.

[0067] FIG4 shows a flow chart of a data encryption method 200 according to an embodiment of the present application. Detailed descriptions of the steps in FIG5 are given below.

[0068] In S201 , plaintext data is acquired and converted into binary format data.

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

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

[0071] The converted binary format data can be internally replaced according to the second conversion rule based on the examples in FIG. 3 a and Table 4.

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

[0073] For the pre-processed 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.

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

[0075] For the first converted data, a similar processing method as in S202 can be used to internally replace the first converted data with the third converted 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 to greatly improve the ability to resist brute force cracking.

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

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

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

[0079] Fig. 5 shows a flow chart of a data conversion method 300 according to an embodiment of the present application. The method 300 includes the following steps.

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

[0081] 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 The data of m bits 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 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).

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

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

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

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

[0086] FIG6 shows a schematic diagram of the method 300 in FIG5. In FIG6, the first replacement data is a data stream of "11100110...0000...". FIG6 (a) shows a data stream of 2 n The first replacement data is divided into multiple data units, where n=4. In the first data unit, "1110 0110...0000" is numbered from 0 to F. Similarly, subsequent data units are numbered in a similar manner.

[0087] The third conversion rule in Figure 6 refers to the example in Figure 3a (Table 4). According to Figure 3a, the data originally numbered 0 is now numbered F. The updated value F can be directly determined based on the index in Figure 3a, using the subscript 0. For other numbers, the updated value can also be determined based on the subscript.

[0088] In Figure 6(b), the updated numbers are reordered from 0 to F, and the generated data stream is "11011000...1110..." As shown in Figure 6, after the multiple m-bit data of the first replacement data are positionally transformed by the third transformation rule, the complexity of the ciphertext data can be increased.

[0089] FIG7 shows a flow chart of a data encryption method 400 according to an embodiment of the present application.

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

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

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

[0093] In FIG6(b), data with the same number in each data unit can be selected, for example, data numbered 0 in the first, second, third, etc. Alternatively, data with adjacent numbers in each data unit can be selected, for example, data numbered 0 and 1 in the first, second, third, etc. This application does not limit the method for selecting data in a data unit, and various other methods can be used for selection. This process can be repeated in this manner until all data in the data units are selected to form multiple new data units.

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

[0095] The new data units are combined to generate ciphertext data. For example, in FIG6 (b), the ciphertext data can be generated from left to right in the order of rows. This application does not limit the combination method in the data units, and various other combination methods can be used.

[0096] The present application also discloses a data decryption method 500 , which corresponds to the encryption method 100 and is now described with reference to FIG. 8 .

[0097] 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.

[0098] 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.

[0099] 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.

[0100] At S504 , the segmented data is reorganized into reorganized data, where the reorganized data includes a plurality of m-bit data.

[0101] At S505 , plaintext data is obtained based on the recombined data.

[0102] 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, as illustrated below.

[0103] When the method 100 includes a pre-processing 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 plaintext data according to the second conversion rule.

[0104] In some embodiments, when generating ciphertext data according to the first conversion data in method 100 includes performing permutation processing 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.

[0105] 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.

[0106] 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.

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

[0108] 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 herein, the processor 602 may be configured to execute one or more embodiments according to the various embodiments shown in Figures 1-8.

[0109] 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 .

[0110] 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).

[0111] 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 an HDD (Hard Disk Drive), a CD (Compact Disc) drive, and a DVD (Digital Versatile Disc) drive.

[0112] 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.

[0113] 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 implement the methods illustrated in Figures 1, 4-5, 7-8. In some embodiments, instructions 620, hardware, firmware, and / or software components thereof may additionally or alternatively reside in system control logic 608, network interface 610, and / or processor 602.

[0114] 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).

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

[0116] 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 the 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.

[0117] Program code can be implemented with a high-level programming language or an object-oriented programming language to communicate with the processing system. Where 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 particular programming language. In either case, the language can be a compiled language or an interpreted language.

[0118] One or more aspects of at least one embodiment may be implemented as representative instructions stored on a computer-readable storage medium, which represent various logic within a processor and, when read by a machine, causes 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 various customers or manufacturing facilities to load into fabrication machines that actually manufacture the logic or processor.

[0119] 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.

[0120] 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.

[0121] The above is an explanation of the implementation mode of the present application by specific specific embodiments. 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 this implementation mode. In order to provide an in-depth understanding of the present application, the above description contains many specific details. 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, in the absence of conflict, the embodiments in the present application and the features in the embodiments can be combined with each other.

[0122] Furthermore, various operations will be described as multiple discrete operations in a manner that is most helpful in 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.

[0123] 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)."

[0124] 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 form readable by a machine (e.g., a computer). Therefore, machine-readable media include any type of machine-readable media suitable for storing or transmitting electronic instructions or information in a form readable by a machine (e.g., a computer).

[0125] It should be understood that although the terms "first," "second," and the like may be used herein 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 reference numerals and letters represent similar items in the following drawings. Therefore, once an item is defined in one drawing, it does not need to be further defined or explained in the subsequent drawings.

[0126] 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 method for encrypting data used in an electronic device, wherein the method comprises the steps of: receiving plaintext data and converting the plaintext data into data in binary format, wherein the data in binary format comprises a data stream consisting of a plurality of m-bit data elements, where m is a positive integer; segmenting the data in binary format to obtain segmented data, wherein the segmented data comprises a plurality of (m-1)-bit data elements; obtain the first transformation rule, where the first transformation rule contains a correspondence relation between 2 m-1 consecutive data elements and 2 m sequential data elements; transforming the segmented data into first transformed data in accordance with a first transformation rule, wherein the first transformed data comprises a plurality of m-bit data elements; and generate ciphertext data in accordance with the first transformed data.

2. The method according to paragraph 1, further comprising a step of pre-processing data in binary format, wherein at the pre-processing step: obtain a second transformation rule, where the second transformation rule contains a correspondence relation between different data elements among 2 m consecutive data elements; and convert the binary data into second converted data according to the second conversion rule.

3. The method according to paragraph 1, wherein at the stage of generating encrypted text data in accordance with the first transformed data: obtain a third transformation rule, where the third transformation rule contains a correspondence relation between different data elements among 2 m sequential data elements; transform the first transformed data into third transformed data in accordance with a third transformation rule; and generate ciphertext data in accordance with the third transformed data.

4. The method according to paragraph 3, wherein at the stage of converting the first converted data into third converted data in accordance with the third conversion rule: sequentially numbering, in the first transformed data, each data element in each data block on a data block basis; update, in each data block, the number of each data element in accordance with the third transformation rule; and reorder each data element according to the updated number to obtain the third transformed data.

5. The method according to paragraph 3, wherein at the stage of generating encrypted text data in accordance with the third transformed data: divide the third transformed data into a plurality of data blocks; selecting, in accordance with a given rule, one or more data elements from each data block among a plurality of data blocks to form a plurality of new data blocks; and combine multiple new blocks of data to produce ciphertext data.

6. The method according to claim 1, wherein m is an integer multiple of 4.

7. A method for decrypting data used in an electronic device, wherein the method comprises the steps of: receiving ciphertext data, wherein the ciphertext data is in binary format and comprises a data stream consisting of a plurality of m-bit data elements, where m is a positive integer; obtain the first transformation rule, where the first transformation rule contains a correspondence relation between 2 m-1 consecutive data elements and 2 m sequential data elements; transforming the ciphertext data into segmented data in accordance with a first transformation rule, wherein the segmented data is a plurality of (m-1)-bit data elements; recombining the segmented data into recombined data, wherein the recombined data comprises a plurality of m-bit data elements; and obtain plaintext data from the recombined data.

8. The method according to paragraph 7, further comprising the steps of: obtain a second transformation rule, where the second transformation rule contains a correspondence relation between different data elements among 2 m consecutive data elements; and transform the recombined data into plaintext data according to the second transformation rule.

9. The method according to claim 7, further comprising the steps of: obtain a third transformation rule, where the third transformation rule contains a correspondence relation between different data elements among 2 m sequential data elements; generate third party data in accordance with the ciphertext data; and transform the third transformed data into the first transformed data according to the third transformation rule.

10. The method according to claim 9, wherein at the step of converting the third converted data into the first converted data in accordance with the third conversion rule: sequentially numbering, in the third transformed data, each data element in each data block on a data block basis; update, in each data block, the number of each data element in accordance with the third transformation rule; and reorder each data element according to the updated number to obtain the first transformed data.

11. An electronic device comprising a memory storing machine-executable instructions and a processor; wherein the execution of the instructions by the processor causes the device to implement the method according to any one of paragraphs 1-10.

12. A machine-readable storage medium storing one or more programs, wherein said one or more programs are executed by one or more processors for implementing the method according to any of paragraphs 1-10.

13. A computer software product containing a computer program, wherein the computer program, when executed by a processor, implements the method according to any one of paragraphs 1-10.