Self-adaptive multi-cycle deep encryption method and electronic equipment thereof

Through the adaptive multi-loop deep encryption method, custom obfuscated strings and keys are generated, the insertion position is determined and multi-loop encryption is performed, which solves the problem of insufficient security of existing encryption algorithms in different data structures and scenarios, and achieves higher security and robustness.

CN120281473APending Publication Date: 2025-07-08TIANJIN SINO GERMAN VOCATIONAL TECHNICAL COLLEGE
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202510517612.6
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-04-24
Publication Date
2025-07-08

AI Technical Summary

Technical Problem

When faced with different data structures and scenarios, the existing encryption algorithms are limited to the fact that the fixed-length key and plaintext regularity are too obvious, resulting in an increase in the possibility of being analyzed or exhaustively broken, and cannot meet the higher security and data encryption robustness requirements required for data communication between different services.

Method used

Adaptive multi-loop depth encryption method is adopted to generate the initial obfuscation string by custom obfuscation string generation function, and the adaptive encryption key is calculated using the key custom generation function and related parameters, and the insertion position of the obfuscation string in the plain text is determined, and the intercepted subkey is used for multi-loop depth encryption, and the adaptive encryption algorithm type is selected for encryption.

Benefits of technology

It improves the security and robustness of encrypted data, can adapt to data structures in different application scenarios, and the generated ciphertext is difficult to break through the exhaustive method, and is especially suitable for small systems to control the encryption of data flow.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120281473A_ABST
    Figure CN120281473A_ABST
Patent Text Reader

Abstract

The invention discloses a self-adaptive multi-cycle deep encryption method and electronic equipment thereof, and belongs to the technical field of data encryption and decryption. The method comprises the following steps: generating an initial confusion character string through a customizable confusion character string generation function; calculating and generating a self-adaptive encryption key by using a key self-defined generation function and related parameters; intercepting a part of keys from the generated self-adaptive encryption keys according to a self-defined key interception position function and an encryption depth function to serve as sub-keys actually used for encryption; determining the insertion position of the confusion character string in the plaintext; inserting the confused character string into the determined insertion position, and generating a confused plaintext, namely an original text; performing multi-cycle deep encryption on the original text by using the intercepted sub-key; and selecting a preset encryption algorithm type according to the encryption algorithm type parameter to carry out multi-cycle deep encryption. And a solution is provided for the requirements of higher security and data encryption robustness.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of data encryption and decryption, and more particularly to an adaptive multi-loop depth encryption method and its electronic device. Background Art

[0002] With the advent of the information age, various forms of information have begun to be expressed and transmitted in the form of data. Such digital data is often vulnerable to attacks and forgery. Information and communication technologies (ICTs) such as the Internet of Things have been introduced into intelligent remote measurement and control systems, and previously independently operating control systems have been integrated into an open architecture environment, and data security has become the key in the design of intelligent systems.

[0003] To date, many technologies have been proposed for data encryption. Among these, the main mainstream symmetric encryption technologies are the Data Encryption Standard DES, the Triple Data Encryption Standard 3DES, and the Advanced Encryption Standard AES encryption technology. However, most of the encryption algorithms proposed so far are designed for changes in the encryption method. In the face of different data structures, scenarios, and service environments, these encryption algorithms are limited by the fixed-length key and the fixed plaintext, and their regularity is too obvious, resulting in a greatly increased possibility of being analyzed or brute-forced, and unable to meet the requirements of higher security and data encryption robustness for data communication between different services.

[0004] Therefore, how to provide an adaptive multi-loop depth encryption method and its electronic device is an urgent problem to be solved by those skilled in the art. Summary of the Invention

[0005] In view of this, the present invention provides an adaptive multi-loop depth encryption method and its electronic device, which are used for encrypting and decrypting data streams with different structures in different application scenarios, and can effectively perform multiple superimposed encryptions on the data stream with any encryption algorithm and any customizable key, thereby greatly improving the security and stability of the ciphertext.

[0006] To achieve the above object, the present invention provides the following technical solutions: An adaptive multi-loop depth encryption method, comprising: generating an initial obfuscation string through a customizable obfuscation string generation function; calculating and generating an adaptive encryption key by using a key self-definition generation function and related parameters; intercepting a part of the key from the generated adaptive encryption key as the sub-key actually used for encryption according to a self-defined key intercepting position function and an encryption depth function; determining the insertion position of the obfuscation string in the plaintext; Insert the obfuscated string into the determined insertion position and generate the obfuscated plaintext; Use the intercepted sub-key to perform multi-loop depth encryption on the obfuscated plaintext; Select a preset encryption algorithm type according to the encryption algorithm type parameter to perform multi-loop depth encryption.

[0007] Further, the formula for the obfuscated string is: ; In the formula, S represents the obfuscated string; represents the function for generating the obfuscated string, and I represents the input set.

[0008] Further, the adaptive encryption key includes: the length of the obfuscated string, the length of the plaintext, the obfuscated string position coefficient, the encryption algorithm type, the encryption depth coefficient, the key interception position coefficient, and the padding random string.

[0009] Further, the interception formula for intercepting a part from the generated adaptive encryption key as the sub-key actually used for encryption is: ; Where kpos represents the key interception position value; represents the customizable key interception function, L represents the length of the plaintext; KP represents the key interception position coefficient value; The formula for key interception during encryption is: ; In the formula, Key represents the original key; represents the length of the original key; kpos represents the starting position of key interception; deep represents the encryption depth; represents a random string of length n; represents the substring intercepted from the i-th byte to the j-th byte of the key; represents the intercepted key fragment used for this encryption, starting from the kpos value and with a constant length of deep.

[0010] Further, the formula for determining the insertion position of the obfuscated string in the plaintext is: ; In the formula, pos represents the insertion position of the obfuscated string; represents the customizable obfuscated string insertion position generation function for calculating the insertion position, L represents the length of the plaintext; SP represents the obfuscated string position coefficient.

[0011] Further, the formula for inserting the obfuscated string into the determined insertion position is: ; Wherein, O represents the plaintext after inserting the confusion string, i.e., the encrypted original text; represents the first part of the plaintext, i.e., the first pos characters of the plaintext; S represents the confusion string; represents the second part of the plaintext, i.e., the remaining characters of the plaintext.

[0012] Furthermore, a preset encryption algorithm type is selected according to the encryption algorithm type parameter for multi-loop depth encryption. The process of multi-loop depth encryption is as follows: ; ; ; Wherein, AlgType represents the encryption algorithm type; O represents the encrypted original text; Charset represents the character encoding set; represents assuming deepN rounds of encryption are performed; represents the ciphertext used in the i-th round; is the finally obtained ciphertext, i.e., ; represents the encryption algorithm function; represents the value range of the encryption algorithm type parameter, where 1 represents the DES encryption algorithm, 2 represents the 3DES encryption algorithm, 3 represents the AES encryption algorithm; K represents the key fragment obtained after corresponding cyclic truncation, represents the key fragment required for the DES encryption algorithm, represents the key fragment required for the 3DES encryption algorithm, represents the key fragment required for the AES encryption algorithm; represents converting the encrypted original text O according to the specified character set; DES_Encrypt, 3DES_Encrypt, and AES_Encrypt all represent the encryption operations of the standard block symmetric encryption algorithm; represents the encryption algorithm function; represents looping from 1 to deepN; represents the i-th round key truncation function; represents the cyclic encryption function.

[0013] Furthermore, it also includes cyclic decryption. The formula for the cyclic decryption process is: ; ; ; Wherein, AlgType represents the decryption algorithm type; C represents the ciphertext; Charset represents the character encoding set; It is assumed that deepN rounds of decryption are performed, and O represents the original encrypted text; It represents decoding the ciphertext C according to the specified character set Charset; DES_Decrypt, 3DES_Decrypt, and AES_Decrypt all represent the decryption operations of the standard block symmetric encryption algorithm; It represents the decryption algorithm function; It represents looping from deepN to 1; It represents the j-th round key truncation function, which is the opposite of the encryption key truncation. It represents the loop decryption function.

[0014] An electronic device includes a memory, a processor, and a computer program stored on the memory and executable on the processor. When the processor executes the computer program, it implements the steps of an adaptive multi-loop depth encryption method.

[0015] As can be seen from the above technical solutions, compared with the prior art, the present invention discloses an adaptive multi-loop depth encryption method and its electronic device, which have good security and robustness. Based on the random generation of keys, the random position confusion of plaintext, and the independent selection of encryption algorithms and encryption loop times, the encryption algorithm proposed by the present invention has good adaptability and can be applied to the encryption of data streams with different data structures in different application scenarios, which can significantly improve the security of encrypted data. For any data stream, the present invention can quickly encrypt random keys and confused plaintext. The generated ciphertext cannot be broken by brute force due to the adaptability of its key and encryption process, and it is particularly suitable for the encryption of small-scale system control data streams. BRIEF DESCRIPTION OF THE DRAWINGS

[0016] In order to more clearly illustrate the technical solutions in the embodiments of the present invention or the prior art, the following will briefly introduce the drawings required for the description of the embodiments or the prior art. Obviously, the drawings in the following description are only the embodiments of the present invention. For those of ordinary skill in the art, other drawings can be obtained according to the provided drawings without creative efforts.

[0017] Figure 1 It is the overall structure of the adaptive multi-loop depth encryption method of the present invention; Figure 2 It is the schematic diagram of the encryption process of the adaptive multi-loop depth encryption method of the present invention; Figure 3 It is the adaptive encryption key structure of the present invention; Figure 4 It is the key truncation method of the adaptive encryption method of the present invention; Figure 5Schematic diagram of the decryption process of the adaptive decryption method of the present invention. Specific embodiments

[0018] The following will clearly and completely describe the technical solutions in the embodiments of the present invention with reference to the accompanying drawings in the embodiments of the present invention. Obviously, the described embodiments are only a part of the embodiments of the present invention, rather than all the embodiments. All other embodiments obtained by those of ordinary skill in the art based on the embodiments of the present invention without creative efforts shall fall within the protection scope of the present invention.

[0019] The object of the present invention is to provide an adaptive multi-cycle depth encryption method and its electronic device. The encryption process can be sequentially divided into the following six links: generation of a scrambled string, generation of an adaptive encryption key, truncation of the key, generation of the insertion position of the scrambled string, plaintext scrambling, and multi-cycle depth encryption. Specifically, it includes: generating an initial scrambled string through a customizable scrambled string generation function; calculating and generating an adaptive encryption key by using a key self-definition generation function and related parameters; truncating a part of the key from the generated adaptive encryption key as the sub-key actually used for encryption according to a customizable key truncation position function and an encryption depth function; determining the insertion position of the scrambled string in the plaintext; inserting the scrambled string into the determined insertion position and generating the scrambled plaintext; performing multi-cycle depth encryption on the scrambled plaintext by using the truncated sub-key; and selecting a preset encryption algorithm type for multi-cycle depth encryption according to the encryption algorithm type parameter. A solution is provided for the requirements of higher security and data encryption robustness needed for data communication between different services in the prior art.

[0020] To make the above objects, features, and advantages of the present invention more obvious and understandable, the present invention will be further described in detail below with reference to the accompanying drawings and specific embodiments.

[0021] As Figure 1 shown, the embodiments of the present invention disclose an adaptive multi-cycle depth encryption method, providing an adaptive encryption algorithm for different structural data streams in different application scenarios. The overall structure is composed of three sub-structures, namely, an adaptive encryption key, the encrypted original text after adding a scrambled string, and different types of encryption algorithms; Based on the above structure, according to the execution order, the encryption process of the proposed adaptive chaos algorithm can be sequentially divided into the following six links: generation of a scrambled string, generation of an adaptive encryption key, truncation of the key, generation of the insertion position of the scrambled string, plaintext scrambling, and multi-cycle depth encryption. Its encryption process is as Figure 2 shown, specifically including: Generating an initial scrambled string through a customizable scrambled string generation function; Calculate and generate an adaptive encryption key by using a key custom generation function and related parameters; Intercept a part of the key from the generated adaptive encryption key as the sub-key actually used for encryption according to a custom key intercept position function and an encryption depth function; Determine the insertion position of the obfuscation string in the plaintext; Insert the obfuscation string into the determined insertion position and generate the obfuscated plaintext; Perform multi-loop depth encryption on the obfuscated plaintext using the intercepted sub-key; Select a preset encryption algorithm type according to the encryption algorithm type parameter to perform multi-loop depth encryption.

[0022] In a specific embodiment, the generation part of the obfuscation string includes: Provide a general interface for generating an obfuscation string. Developers can provide a function for generating an obfuscation string through this interface for generating the obfuscation string of the adaptive encryption algorithm. If the developer does not give a function for generating the obfuscation string, then the adaptive encryption algorithm will provide a default obfuscation string. The obfuscation string of the adaptive encryption algorithm is shown in formula (1): (1) Where S represents the obfuscation string; Represents a function for generating an obfuscation string, which can be defined by the developer himself. The developer can select a suitable generation method according to specific requirements. For example, Can be a random generation function, a hash function, an encryption function, etc.; I represents an input set, which can contain any necessary information. Specifically, what is included depends on The implementation of, but is not limited to specific parameters.

[0023] In order to maintain the generality of the method for generating the obfuscation string, the obfuscation string formula can cover various generation methods. Developers can flexibly define And I by themselves according to specific requirements in the specific application scenario to obtain an obfuscation string S suitable for the current application.

[0024] In a specific embodiment, as Figure 3 Shown, in the present invention, the key K includes seven parts: the length of the obfuscation string, the length of the plaintext, the obfuscation string position coefficient, the encryption algorithm type, the encryption depth coefficient, the key intercept position coefficient (optional), and the padding random string. Each part is separated by a specific delimiter FF: The first part is the length of the obfuscation string S. The purpose of the obfuscation string is to obfuscate the plaintext and hide the real plaintext information in the random string. This part is to indicate the length of the obfuscation string mixed with the plaintext; The second part is the length value L of the plaintext to be encrypted. This value, in combination with the obfuscation string position coefficient and the obfuscation string length, can calculate the position of the obfuscation string in the plaintext, and add or delete the obfuscation string during the encryption and decryption processes; The third part is the position coefficient value SP where the obfuscation string is inserted in the plaintext. This value is used to calculate the insertion position of the obfuscation string in the plaintext; The fourth part is the encryption algorithm type AlgType. The adaptive encryption algorithm provides different types of encryption algorithms for encryption calculations. Developers can select the appropriate encryption algorithm type according to different encryption environments based on the different types of encryption algorithms provided by the adaptive encryption algorithm, mainly including three types: DES algorithm, 3DES algorithm, and AES algorithm; The fifth part is the encryption depth coefficient deepN, as shown in formula (2): (2) Where deep represents the encryption depth and is used to control the number of loop traversals of the adaptive encryption algorithm.

[0025] The adaptive encryption algorithm will circularly encrypt the original encrypted text through the encryption key. deepN is the value of the number of circular encryption times, and this value is an integer; k represents the fixed key length of different encryption algorithm types, and this value is related to the encryption algorithm type AlgType; The sixth part is the key truncation position coefficient KP (optional). The adaptive encryption algorithm mainly circularly truncates the encryption key to circularly encrypt the original encrypted text. Then, the position from which the encryption key starts to be truncated is calculated from the key truncation position coefficient KP and the plaintext length L. This coefficient can also be absent. In this case, the obfuscation string insertion position coefficient SP is defaultly used to replace KP in the calculation of the key truncation position; The seventh part is the padding random string. According to the proposed encryption algorithm structure, the generated key starts from the set truncation position, and the remaining length should satisfy being greater than or equal to deepN times the fixed key length k of the selected encryption algorithm. If the current key length is insufficient, it is supplemented by the padding random string.

[0026] In a specific embodiment, the original encrypted text is circularly encrypted by circularly truncating the encryption key. The position from which the encryption key starts to be truncated is calculated from the key truncation position coefficient KP and the plaintext length L. The key truncation is shown in formula (3): (3) Where kpos represents the key truncation position value, and this value should satisfy ; Represents a customizable key truncation function. L and KP are input parameters of formula (3) used to calculate a key truncation position value within ; L represents the plaintext length; KP represents the key truncation position coefficient value, which should satisfy . This value is optional. When this value is not explicitly given, it defaults to the same as the obfuscation string insertion position coefficient value SP. In this case, the adaptive encryption key does not include the truncation position coefficient KP part and consists of six parts. The key truncation position value, like the obfuscation string insertion position value, can be calculated using functions that meet the requirements, such as linear mapping functions, non-linear mapping functions, random offset functions, logarithmic mapping functions, etc.

[0027] Specifically, the key cyclic truncation method of the adaptive encryption algorithm is as shown in Figure 4 . It can be seen from formula (2) that the encryption depth deep length is composed of the sum of deepN k lengths. Then, the key cyclic truncation of the adaptive encryption algorithm starts from the key truncation position kpos and truncates a length of deep value from left to right. The key truncation during the adaptive encryption algorithm is as shown in formula (4): (4) Where Key represents the original key; represents the original key length; kpos represents the key truncation start position; deep represents the encryption depth; represents a random string of length n; represents the substring intercepted from the i-th byte (inclusive) to the j-th byte (exclusive) of the key; represents the intercepted key fragment used in this encryption, starting from the kpos value and with a constant length of deep. So when the length of kpos + deep is less than or equal to , the intercepted key is , that is, starting from the kpos value position, intercept the length from kpos (inclusive) to kpos + deep (exclusive); when the length of kpos + deep is greater than , it means is insufficient. Then the adaptive encryption algorithm will automatically supplement and fill the random string rStr until it is equal to the length of kpos + deep. So the intercepted key is , that is, first intercept the length from the kpos value position from kpos (inclusive) to , and then add rStr to supplement to length (exclusive).

[0028] In contrast, when performing decryption, the adaptive encryption algorithm intercepts the key fragment from the position kpos + deep from right to left in the reverse way of encryption key interception. The key circular interception formula during decryption of the adaptive encryption algorithm is shown in (5): (5) where Key represents the original key; represents the length of the original key; kpos represents the starting position of key interception; deep represents the encryption depth; represents a random string of length n; represents from right to left, with the subscript decreasing from i to j + 1; represents reversing the string to obtain the actual key fragment from right to left; represents the intercepted key fragment used for this decryption, starting from the kpos value and with a constant length of deep. So when kpos + deep is less than or equal to , the intercepted key is intercepted from kpos + deep - 1 to the kpos position; when kpos + deep is greater than , the intercepted key is the length from the position to the kpos position. Since the key used for decryption must be equal to the encryption key to complete decryption, so when the decryption kpos + deep is greater than , that is, in the encryption stage, the adaptive encryption algorithm has completed the key length padding of the key. Therefore, the intercepted key fragment during decryption must start from first.

[0029] By combining the encryption depth deep and the key interception position kpos, and cooperating with the encryption and decryption formulas, the required length of key fragments can be intercepted or spliced from the key respectively during the encryption and decryption processes. And the adaptive encryption algorithm will automatically handle the situation of insufficient length, so as to achieve the key interception strategy shown in Figure 4 . This design method of the adaptive encryption algorithm reflects its self - adaptability, and the encryption key length increases automatically according to different situations.

[0030] The insertion position of the obfuscation string is shown in formula (6): (6) where pos represents the insertion position of the obfuscation string; represents a customizable obfuscation string insertion position function for calculating the insertion position. If the developer does not provide the obfuscation string insertion position function, then the adaptive encryption algorithm can set the default obfuscation string insertion position; L represents the length of the plaintext; SP represents the obfuscation string position coefficient, and this value should satisfy , used to control the distribution of the insertion positions. The insertion position pos of the confusion string should satisfy , that is, within the valid range of the plaintext.

[0031] The adaptive encryption algorithm provides an open confusion string insertion position function, which only provides the definition standard of the confusion string insertion position function. Developers can customize their own confusion string insertion position functions according to specific requirements. For example, linear mapping functions, non-linear mapping functions, logarithmic mapping functions, and random offset functions can be used as the confusion string insertion position functions.

[0032] After generating the insertion position pos of the confusion string, the adaptive encryption algorithm will insert the confusion string S into the corresponding position of the plaintext M according to the pos value, as shown in formula (7): (7) Where O represents the original text to be encrypted; represents the first part of the plaintext, that is, the first pos characters of the plaintext; S represents the confusion string; represents the second part of the plaintext, that is, the remaining characters of the plaintext. Developers can select an appropriate confusion string encryption function according to their own encryption needs to avoid overly concentrated or overly dispersed position distributions.

[0033] In a specific embodiment, the confusion and cyclic encryption / decryption of the plaintext include: After generating a random key, the plaintext can be confused according to the key, inserting the confusion symbol at the calculated random position, and then using the selected encryption algorithm to perform deepN times of cyclic encryption (deepN is the number of times of cyclic encryption, that is, the cyclic encryption coefficient) on the confused plaintext, that is, the original text O, using the key K.

[0034] (1) Plaintext confusion: According to the insertion position of the confusion string calculated by formula (6), the confusion string generated by formula (1) is confused with the plaintext (inserting the confusion string into the plaintext or inserting the plaintext into the confusion string) to generate the original text O to be encrypted.

[0035] (2) Cyclic encryption / decryption of the original text: As Figure 4 shown, the cyclic encryption of the adaptive encryption algorithm takes out a k-length key segment from left to right from the intercepted key in each round , and the specific k value depends on the type of encryption algorithm selected for this encryption. Use each key segment to encrypt the current encrypted original text. After multiple rounds of encryption, the final ciphertext C is obtained. The cyclic encryption process is shown in formula (8): (8) Among them, AlgType represents the encryption algorithm type; O represents the original text to be encrypted; Charset represents the character encoding set, such as UTF-8, etc.; It is assumed that deepN rounds of encryption are performed. Then the key fragment used in the i-th round is , until the encryption reaches ; represents the ciphertext used in the i-th round , until the finally obtained ciphertext , that is ; represents the encryption algorithm function, and the parameters are the original text O or ciphertext to be encrypted , the key fragment , and the character encoding set Charset. Different types of encryption algorithms are controlled by the AlgType parameter.

[0036] The encryption parts of different types of encryption algorithms in the adaptive encryption algorithm are shown in formula (9): (9) Among them represents the value range of the encryption algorithm type parameter. Among them, 1 represents the DES encryption algorithm, 2 represents the 3DES encryption algorithm, and 3 represents the AES encryption algorithm; O represents the original text to be encrypted; K represents the key fragment obtained after corresponding cyclic truncation, represents the key fragment required for the DES encryption algorithm, and the fixed number of bytes is 8, represents the key fragment required for the 3DES encryption algorithm, and the fixed number of bytes is 24, represents the key fragment required for the AES encryption algorithm, and the fixed number of bytes is 16; Charset represents the character encoding set; represents encoding the original text O to be encrypted according to the specified character set, such as UTF-8, to obtain a byte sequence; encryption functions such as DES, 3DES, and AES all represent the encryption operations of the standard block symmetric encryption algorithm; represents the encryption algorithm function, where the parameters are the original text O to be encrypted, the key fragment K, and the character encoding set Charset. Different types of encryption algorithms are controlled by the AlgType parameter.

[0037] Combining the cyclic truncated key with different types of encryption algorithms, the final encryption formula is shown in (10): (10) Among them represents cycling from 1 to deepN; represents the i-th round key truncation function, and the parameters are the key Key, the key truncation position , and the fixed value k of the key truncation length, Denotes the key segment intercepted in the i-th round of the key. Denotes the cyclic encryption function, with the parameter being the ciphertext , when i = 1 , Is the original text O to be encrypted, Denotes the key segment; Charset denotes the character encoding set; AlgType denotes the encryption algorithm type.

[0038] The cyclic decryption of the adaptive encryption algorithm is the reverse process of encryption, that is, in each round, a key segment of length k is taken from the intercepted key from right to left , and the specific value of k depends on the decryption algorithm type selected for this decryption. Use each key segment To decrypt the current ciphertext. After multiple rounds of decryption, the original encrypted text O is obtained. The formula for the cyclic decryption process is as shown in (11): (11) Where AlgType denotes the decryption algorithm type; C denotes the ciphertext; Charset denotes the character encoding set, such as UTF-8, etc.; Denotes that assuming deepN rounds of decryption are performed, then the key segment used in the i-th round is , until decrypting to ; Denotes the original encrypted text used in the i-th round , until finally decrypting to , that is, the original encrypted text O; Denotes the decryption algorithm function, with the parameter being the original encrypted text , the key segment , the character encoding set Charset, and different types of decryption algorithms are controlled by the AlgType parameter.

[0039] The decryption part of different types of encryption algorithms in the adaptive encryption algorithm is as shown in formula (12): (12) Where C denotes the ciphertext; Denotes decoding the ciphertext C according to the specified character set Charset; Decryption functions such as DES, 3DES, AES (DES_Decrypt, 3DES_Decrypt, AES_Decrypt) all represent the decryption operations of standard block symmetric encryption algorithms; Denotes the decryption algorithm function, where the parameters are the ciphertext C, the key segment K, and the character encoding set Charset, and different types of decryption algorithms are controlled by the AlgType parameter. The rest is the same as the encryption formula.

[0040] Decryption is the reverse process, as shown in formula (13): (13) where means looping from deepN to 1; represents the j-th round key truncation function, which is opposite to the encryption key truncation, truncating from right to left, with the parameter being the key Key, the key truncation position , and the fixed key truncation length value k; represents the loop decryption function, with the parameter being represents the j-th round encrypted original text , when iterating to j = 1 , that is, the encrypted original text O, represents the key fragment; Charset represents the character encoding set; AlgType represents the decryption algorithm type.

[0041] The decryption process flow of the adaptive encryption algorithm is exactly the opposite of the encryption process, and its flowchart is as Figure 5 shown.

[0042] In this embodiment, only three different types of encryption algorithms are exemplified for the different types of encryption algorithms of the adaptive encryption algorithm, namely DES, 3DES, and AES algorithms. However, the adaptive encryption algorithm is an open design in terms of design, and the encryption algorithms that can be added are not limited to these three. At the same time, the functions selected in the calculation process of the key screenshot position and the obfuscation string insertion position are not limited to the functions listed in the text, as long as they meet the requirements of the algorithm.

[0043] On the other hand, the embodiment of the present invention discloses an electronic device, including a memory, a processor, and a computer program stored on the memory and executable on the processor. When the processor executes the computer program, the steps of the above-mentioned adaptive multi-loop depth encryption method are implemented.

[0044] Specifically, the best implementation manner of the present invention is as follows: Taking the encryption of the plaintext "Tianjin Sino-German University of Applied Sciences" as an example.

[0045] As Figure 3 shown, the adaptive encryption algorithm encrypts starting from receiving the plaintext string "Tianjin Sino-German University of Applied Sciences" to be encrypted, and generates an obfuscation string S through the obfuscation string function , the parameter of which is any parameter that can participate in the obfuscation string. The obfuscation string function adopts a hash function here, as shown in formula (14): (14) Where S represents the obfuscated string; Hash represents a hash algorithm, such as SHA-256; K represents the encryption key; M represents the plaintext; slat represents a random value used to enhance security; || represents the concatenation operation. By encrypting the encryption key parameter, the plaintext parameter, and the random value salt parameter with the hash algorithm and concatenating the three parameters, the obfuscated string S is obtained.

[0046] Through the obfuscated string insertion position function Generate the obfuscated string insertion position pos, whose parameters are the plaintext length L and the obfuscated string coefficient SP. Here, the logarithmic mapping function is used to distribute the obfuscated string insertion position, and the logarithmic mapping function is shown in formula (15): (15) Where pos represents the obfuscated string insertion position, and this value should satisfy ; L represents the plaintext length; SP represents the obfuscated string position coefficient, and this value should satisfy ; k represents a constant used to adjust the curvature of the logarithmic function. The logarithmic function can adjust the distribution density of the obfuscated string insertion position according to the value of k. With the generated obfuscated string S and the obfuscated string insertion position pos participating together, the obfuscated string can be inserted into the specified position of the plaintext, thereby obtaining the encrypted original text O.

[0047] Meanwhile, the adaptive encryption algorithm passes through the key truncation position function Generate the key truncation position kpos, whose parameters are the plaintext length L and the key truncation position coefficient KP. Here, we also use the logarithmic mapping function as the key truncation position function for calculation. The adaptive encryption algorithm passes through the encryption depth function Generate the encryption depth, where the fixed value k of the parameter is provided by the encryption algorithm type AlgType. Here, the DES encryption algorithm (AlgType = 1) is used, so k is 8. Another parameter is the encryption depth coefficient deepN, which is used to participate in the encryption depth calculation and is set to 8. Then the encryption depth deep is 64, and the original text O is encrypted in 8 loops.

[0048] The adaptive encryption algorithm key consists of the obfuscated string length, the plaintext length, the obfuscated string position coefficient, the key truncation position coefficient, the encryption depth coefficient, the encryption algorithm type, and the padding random string. Then, according to the key truncation strategy, the key is truncated in sequence to perform loop encryption on different types of encryption algorithms. That is, when , the key truncation segment is ; when , the key truncation segment is . During encryption, the key is truncated from left to right in a loop to intercept 8 key segments of 8 bytes in length Participate in the DES encryption algorithm function with the encrypted original text O The encryption process ends when the ciphertext C is obtained.

[0049] When decrypting, Figure 5 As shown in the figure, the adaptive encryption algorithm decryption process starts with receiving the ciphertext C and the key Key. According to the composition strategy of the adaptive encryption algorithm key Key, the key is split according to FF to obtain the obfuscated string length, obfuscated string insertion position coefficient SP, plaintext length L, key interception position coefficient KP, encryption depth coefficient deepN, and encryption algorithm type AlgType encryption algorithm. As in encryption, the logarithmic mapping function is applied as the key interception position function through formula (5) Generate the key interception position kpos, where the parameters are the plaintext length L and the key interception position coefficient KP. Through the encryption depth function Generate encryption depth deep, where the fixed parameter value k is provided by the encryption algorithm type AlgType, which is the same as encryption. Here, the DES algorithm is selected, AlgType=1, k=8; another parameter is the encryption depth coefficient deepN, where deepN=8, which is used to participate in encryption depth calculation and insert position function through obfuscated string Generate the obfuscated string insertion position pos, where the parameters are the plaintext length L and the obfuscated string insertion position coefficient SP. Here, as in encryption, a logarithmic mapping function is selected as the obfuscated string insertion position function.

[0050] According to the key interception position kpos and encryption depth deep, the key fragment of the adaptive encryption key Key is intercepted to perform cyclic decryption with different types of encryption algorithms. When the key interception fragment is ;when When the key interception fragment is When decrypting, the key is intercepted from right to left, and 8 8-byte key fragments are intercepted cyclically. Participate in DES encryption algorithm function with ciphertext C The decryption process is continued until the encrypted original text O is obtained. According to the obfuscated string insertion position pos and the obfuscated string length, the obfuscated string content in the encrypted original text O is deleted, and finally the original plaintext "Tianjin Sino-German University of Applied Technology" is obtained. At this point, the decryption process of the adaptive encryption algorithm ends.

[0051] In this specification, each embodiment is described in a progressive manner, and each embodiment focuses on the differences from other embodiments. The same or similar parts between the embodiments can be referred to each other. For the device disclosed in the embodiment, since it corresponds to the method disclosed in the embodiment, the description is relatively simple, and the relevant parts can be referred to the method part.

[0052] The foregoing description of the disclosed embodiments enables those skilled in the art to practice or use the present invention. Various modifications to these embodiments will be readily apparent to those skilled in the art, and the general principles defined herein may be implemented in other embodiments without departing from the spirit or scope of the present invention. Thus, the present invention is not intended to be limited to the embodiments shown herein but is to be accorded the widest scope consistent with the principles and novel features disclosed herein.

Claims

1. An adaptive multi-loop depth encryption method, characterized in that, Including: Generate an initial obfuscation string through a customizable obfuscation string generation function; Calculate and generate an adaptive encryption key by using a key customization generation function and related parameters; Intercept a part of the key from the generated adaptive encryption key as the sub-key actually used for encryption according to a custom key interception position function and an encryption depth function; Determine the insertion position of the obfuscation string in the plaintext; Insert the obfuscation string into the determined insertion position and generate the obfuscated plaintext; Perform multi-loop depth encryption on the obfuscated plaintext using the intercepted sub-key; Select a preset encryption algorithm type according to the encryption algorithm type parameter for multi-loop depth encryption.

2. An adaptive multi-loop depth encryption method according to claim 1, characterized in that The formula for the obfuscation string is: ; Where S represents the obfuscated string; represents the function for generating the obfuscated string, and I represents the input set.

3. An adaptive multi-cycle depth encryption method according to claim 1, characterized in that The adaptive encryption key includes: obfuscation string length, plaintext length, obfuscation string position coefficient, encryption algorithm type, encryption depth coefficient, key interception position coefficient, and padding random string.

4. An adaptive multi-loop depth encryption method according to claim 1, characterized in that The interception formula for intercepting a part from the generated adaptive encryption key as the sub-key actually used for encryption is: ; Among them, kpos represents the key truncation position value; represents a customizable key truncation function, L represents the plaintext length; KP represents the key truncation position coefficient value; The formula for key interception during encryption is: ; Wherein, Key represents the original key; represents the length of the original key; kpos represents the starting position of key truncation; deep represents the encryption depth; represents a random string of length n; represents a substring intercepted from the i-th byte to the j-th byte of the key; represents the intercepted key segment used for this encryption, starting from the kpos value and with a constant length of deep.

5. An adaptive multi-loop depth encryption method according to claim 1, characterized in that The formula for determining the insertion position of the obfuscation string in the plaintext is: ; In the formula, pos represents the insertion position of the obfuscation string; represents a user - definable obfuscation string insertion position generation function for calculating the insertion position, L represents the length of the plaintext; SP represents the obfuscation string position coefficient.

6. An adaptive multi-loop depth encryption method according to claim 1, characterized in that The formula for inserting the obfuscation string into the determined insertion position is: ; Wherein, O represents the plaintext after inserting the obfuscation string, i.e., the encrypted original text; represents the first part of the plaintext, i.e., the first pos characters of the plaintext; S represents the obfuscated string; represents the latter part of the plaintext, i.e., the remaining characters of the plaintext.

7. An adaptive multi-loop depth encryption method according to claim 1, characterized in that Select a preset encryption algorithm type according to the encryption algorithm type parameter for multi-loop depth encryption. The process of multi-loop depth encryption is: ; ; ; Where AlgType represents the encryption algorithm type; O represents the original text to be encrypted; Charset represents the character encoding set; Indicates that it is assumed to perform deepN rounds of encryption; Represents the ciphertext used in the i-th round; Is the finally obtained ciphertext, that is ; Represents the encryption algorithm function; Represents the value range of the encryption algorithm type parameter, where 1 represents the DES encryption algorithm, 2 represents the 3DES encryption algorithm, 3 represents the AES encryption algorithm; K represents the key fragment obtained after the corresponding cyclic interception, Represents the key fragment required for the DES encryption algorithm, Represents the key fragment required for the 3DES encryption algorithm, Represents the key fragment required for the AES encryption algorithm; Indicates that the original text O to be encrypted is in accordance with the specified character set; DES_Encrypt, 3DES_Encrypt, and AES_Encrypt all represent the encryption operations of the standard block symmetric encryption algorithm; Represents the encryption algorithm function; Indicates a loop from 1 to deepN; Represents the i-th round key interception function; Represents the cyclic encryption function.

8. An adaptive multi-loop depth encryption method according to claim 1, characterized in that Also including loop decryption. The formula for the loop decryption process is: ; ; ; Wherein, AlgType represents the decryption algorithm type; C represents the ciphertext; Charset represents the character encoding set; It is assumed that deepN rounds of decryption are performed, and O represents the original encrypted text; It represents decoding the ciphertext C according to the specified character set Charset; DES_Decrypt, 3DES_Decrypt, and AES_Decrypt all represent the decryption operations of the standard block symmetric encryption algorithm; It represents the decryption algorithm function; It represents looping from deepN to 1; It represents the j-th round key truncation function, which is the opposite of the encryption key truncation, It represents the loop decryption function.

9. An electronic device, comprising a memory, a processor, and a computer program stored on the memory and executable on the processor, characterized in that, When the processor executes the computer program, it implements the steps of an adaptive multi-loop depth encryption method as described in any one of claims 1 to 8.