Data reinforcement encryption method, device, equipment and medium
By performing segmented encryption, multi-round encryption and compression substitution on the encrypted information, the problem of insufficient security of the DES encryption method is solved, and the high security of the encrypted information is achieved.
Patent Information
- Application Number
- CN202411221680.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-09-02
- Publication Date
- 2025-10-24
- Estimated Expiration
- 2044-09-02
AI Technical Summary
The DES encryption method in the prior art has a short key length and conventional encryption processing technology, resulting in poor security of encrypted information and easy cracking.
The information to be encrypted is initially encrypted and its numerical position is replaced using the preset first secret key. After being split into segments of equal length, it is encrypted multiple times using the second secret key, and compressed and numerically replaced. Finally, the replaced segment is added to the compressed segment, and the encryption operation is iteratively performed until the preset number threshold is reached.
It improves the security of encrypted information, making it impossible to be cracked in a short time, and enhances the protection strength of information.
Smart Images

Figure CN119203173B_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application relates to the technical field of computer, and particularly relates to a data reinforced encryption method and device, equipment and medium. BACKGROUND
[0002] DES (Data Encryption Standard, i.e. data encryption standard) is a kind of symmetric cipher algorithm for encrypting 64-bit plaintext into 64-bit ciphertext, and its key length is 56 bits, and it is a kind of block cipher. Since the DES key is short and the encryption processing technology is relatively common, the DES encryption technology is extremely easy to be cracked in a short time, which affects the security of encrypted information. Therefore, the encryption method in the prior art method has the problem of poor security. SUMMARY
[0003] The embodiments of the present application provide a data reinforced encryption method, device, equipment and medium, aiming at solving the problem of poor security of the encryption method in the prior art method.
[0004] In a first aspect, the embodiments of the present application provide a data reinforced encryption method, and the method comprises the following steps.
[0005] If the inputted to-be-encrypted information is received, the to-be-encrypted information is split into a plurality of information segments according to a preset string length;
[0006] Each information segment is initially encrypted by a preset first key to obtain an initial encryption information segment corresponding to each information segment;
[0007] Each initial encryption information segment is subjected to numerical position permutation according to a preset permutation table to obtain a corresponding permutation information segment;
[0008] Each permutation information segment is split into a first segment and a second segment with equal length;
[0009] The first segment and the second segment are subjected to multi-round cyclic encryption according to a preset second key and an encryption strategy to obtain a first encryption segment and a second encryption segment;
[0010] The first encryption segment and the second encryption segment are subjected to compression processing according to a preset compression rule to obtain a first compression segment and a second compression segment;
[0011] The second compression segment is subjected to numerical permutation according to the compression rule and a preset permutation rule to obtain a corresponding permutation segment;
[0012] the first compressed segment as a new first segment, the added segment as a new second segment, and performing multi-round cyclic encryption on the first segment and the second segment according to a preset second key and an encryption strategy, until the number of cyclic execution times is greater than a preset number threshold, and then outputting the first compressed segment and the permutation segment as final encrypted information segments corresponding to the permutation information segment; the added segment is a segment obtained by adding the permutation segment and the first compressed segment;
[0013] combining the final encrypted information segments corresponding to each information segment to obtain encrypted information corresponding to the to-be-encrypted information.
[0014] In a second aspect, an embodiment of the present application also provides a data intensive encryption device, wherein the device is used to execute the data intensive encryption method in the first aspect, and the device comprises:
[0015] an information splitting unit configured to split the to-be-encrypted information into a plurality of information segments according to a preset string length if the to-be-encrypted information is received;
[0016] an initial encryption processing unit configured to perform initial encryption on each information segment by using a preset first key to obtain an initial encrypted information segment corresponding to each information segment;
[0017] a numerical position permutation unit configured to perform numerical position permutation on each initial encrypted information segment according to a preset permutation table to obtain a corresponding permutation information segment;
[0018] a splitting unit configured to split each permutation information segment into a first segment and a second segment with equal lengths;
[0019] a cyclic encryption unit configured to perform multi-round cyclic encryption on the first segment and the second segment according to a preset second key and an encryption strategy to obtain a first encrypted segment and a second encrypted segment;
[0020] a compression processing unit configured to perform compression processing on the first encrypted segment and the second encrypted segment according to a preset compression rule to obtain a first compressed segment and a second compressed segment;
[0021] a numerical permutation unit configured to perform numerical permutation on the second compressed segment according to the compression rule and a preset permutation rule to obtain a corresponding permutation segment;
[0022] An ultimate encryption segment obtaining unit is configured to take the first compressed segment as a new first segment, take the added segment as a new second segment, and return to perform multi-round cyclic encryption on the first segment and the second segment according to a preset second key and an encryption strategy, until the number of cyclic execution times is greater than a preset number threshold, and then output the first compressed segment and the permutation segment as an ultimate encryption information segment corresponding to the permutation information segment; the added segment is a segment obtained by adding the permutation segment and the first compressed segment.
[0023] An ultimate encryption segment combining unit is configured to combine the ultimate encryption information segment corresponding to each information segment to obtain encryption information corresponding to the information to be encrypted.
[0024] In a third aspect, an embodiment of the present application further provides a computer device, wherein the device comprises a processor, a communication interface, a memory and a communication bus, wherein the processor, the communication interface and the memory complete communication with each other through the communication bus.
[0025] The memory is configured to store a computer program.
[0026] The processor is configured to execute the program stored on the memory to implement the steps of the data intensive encryption method in the first aspect.
[0027] In a fourth aspect, an embodiment of the present application further provides a computer readable storage medium, which stores a computer program, wherein the computer program is executed by the processor to implement the steps of the data intensive encryption method in the first aspect.
[0028] Embodiments of the present application provide a data intensive encryption method, device, equipment and medium, the method comprising: segmenting and encrypting information to be encrypted by a first key to obtain initial encryption information segments, performing numerical position permutation on the initial encryption information segments and performing equal-length splitting, performing multi-round cyclic encryption on the split first segment and second segment according to a second key and an encryption strategy, and then performing compression and numerical permutation to obtain a permutation segment, adding the permutation segment and the first compressed segment, and combining the first compressed segment to iteratively perform the foregoing encryption operation, and combining the ultimate encryption information segments corresponding to each information segment into encryption information. The foregoing method performs initial encryption by a first key, performs multi-round cyclic encryption by a second key, and then performs compression and numerical permutation processing, thereby strengthening the encryption process through two encryption operations. The improved encryption processing method cannot be cracked in a short time, and the security of the encryption information obtained by encryption is greatly improved. BRIEF DESCRIPTION OF DRAWINGS
[0029] In order to more clearly illustrate the technical solutions of the embodiments of the present application, the following will briefly introduce the drawings needed in the embodiment description. Obviously, the drawings in the following description are some embodiments of the present application, and other drawings can also be obtained by those skilled in the art without creative effort.
[0030] Figure 1 The method flowchart of the data reinforcement encryption method provided by the embodiments of the present application is shown in the figure.
[0031] Figure 2 The schematic block diagram of the data reinforcement encryption device provided by the embodiments of the present application is shown in the figure.
[0032] Figure 3 The schematic block diagram of the computer device provided by the embodiments of the present application is shown in the figure. DETAILED DESCRIPTION
[0033] The technical solutions in the embodiments of the present application will be described clearly and completely in the following with reference to the drawings in the embodiments of the present application. Obviously, the described embodiments are some embodiments of the present application, but not all the embodiments. Based on the embodiments in the present application, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present application.
[0034] It should be understood that when used in the specification and the appended claims, the terms "comprise" and "include" indicate the presence of the described features, integers, steps, operations, elements, and / or components, but do not exclude one or more other features, integers, steps, operations, elements, components, and / or groups thereof.
[0035] It should also be understood that the terms used in the present application specification are only for the purpose of describing specific embodiments and are not intended to limit the present application. As used in the present application specification and the appended claims, the singular forms "a", "an" and "the" are intended to include the plural forms unless the context clearly indicates otherwise.
[0036] It should be further understood that the term "and / or" used in the present application specification and the appended claims means any combination of one or more of the associated listed items and all possible combinations, and includes these combinations.
[0037] Please refer to Figure 1 As shown in the figure, the embodiments of the present application provide a data reinforcement encryption method, which is applied to a terminal device. The terminal device can be a notebook computer, a desktop computer, a tablet computer, a mobile phone or the like. As shown in the figure, Figure 1 the method includes steps S110-S190.
[0038] S110, if the inputted information to be encrypted is received, the information to be encrypted is split into multiple information segments according to a preset string length.
[0039] If the inputted information to be encrypted is received, the information to be encrypted is split into multiple information segments according to a preset string length. The user can input the information to be encrypted to the terminal device, and the terminal device splits the information to be encrypted according to the preset string length, thereby obtaining multiple information segments.
[0040] In specific embodiments, step S110 includes the sub-steps of: splitting the information to be encrypted into multiple information segments corresponding to the string length; determining whether the number of characters in the last information segment is equal to the string length; and if the number of characters in the last information segment is not equal to the string length, padding the information segment to obtain a padded information segment.
[0041] Specifically, the information to be encrypted can be split into multiple information segments corresponding to the string length. In the process of sequentially splitting the information to be encrypted, it is necessary to determine whether the number of characters in the last information segment is equal to the string length. If the number of characters in the last information segment is equal to the string length, the information segment does not need to be padded; if the number of characters in the last information segment is not equal to the string length, the information segment needs to be padded by supplementing "0" values, thereby obtaining a padded information segment. After padding the last information segment, the number of characters contained in each information segment is equal to the string length. For example, the string length can be set to 64, and each information segment is a binary information segment containing 64 characters.
[0042] S120, initial encryption of each information segment is performed by using a preset first secret key, thereby obtaining an initial encrypted information segment corresponding to each information segment.
[0043] Initial encryption of each information segment is performed by using a preset first secret key, thereby obtaining an initial encrypted information segment corresponding to each information segment. Specifically, initial encryption of each information segment can be performed by using a DES encryption technology and a first secret key. The initial encryption can first include initial permutation of each information segment, which is a position replacement of values contained in each information segment by using a permutation table.
[0044] The information contained in the permutation table is as follows:
[0045] 58 50 42 34 26 18 10 2 60 52 44 36 28 20 12 4 62 54 46 38 30 22 14 6 64 56 48 40 32 24 16 8 57 49 41 33 25 17 9 1 59 51 43 35 27 19 11 3 61 53 45 37 29 21 13 5 63 55 47 39 31 23 15 7
[0046] Then, for one information segment, the data obtained from the 58th bit of the information segment can be placed in the first position, the data obtained from the 50th bit of the information segment can be placed in the second position, and so on. The permuted segment is split into two parts, L0 and R0, each containing 32-bit data. The first key is a set of 64-bit binary sequences, and the encryption operation formula can be a self-defined calculation formula. The encryption operation formula can be represented by ⊕, for example, X⊕Y can be defined as X⊕Y = X + 2Y - 8. The first key is evenly split to obtain 4 sets of 16-bit binary strings, corresponding to 4 sets of 2-byte values (each byte corresponds to 8 bits, i.e., each byte corresponds to 8-bit data). Each set of byte values is inverted and combined with the original byte array to obtain a set of system parameters; the system parameters can be represented as Fc = (F0, F1, F2, F3), F i (i = 0, 1, 2, 3) are each 4 bytes. Further calculation can obtain the first round key required for each round of encryption, the second round key is (K2, K3, K4, K5, K6, K7, K8, K9), and the last round key is (K 30 , K 31 , K0, K1, K2, K3, K4, K5); wherein (K0, K1, K2, K3) = (Ck0⊕F0, Ck0⊕F1, Ck1⊕F2, Ck1⊕F3), K i+4 = K i ⊕T’(K i+1 ⊕K i+2 ⊕K i+3 ⊕Ck i ), wherein i = 0, 1, 2, …, 31); the fixed parameter CK = (Ck0, Ck1, Ck2, …, Ck 31 , Ck i (i = 0, 1, 2, …, 31) are each 4 bytes (4 bytes correspond to a 32-bit binary number). Then, the round key array composed of the keys required for each round of encryption can be calculated through the above calculation process, and the round key array contains multiple round keys. T’ is the inverse operation process of the reversible transformation T, the reversible transformation T: Z2 32 (32-bit string) → Z2 32 (32-bit string), which is composed of a nonlinear transformation τ and a linear transformation L, i.e., T(x) = L(τ(x)), the nonlinear transformation τ is composed of 4 parallel S boxes, the data of the S boxes are in hexadecimal, and it is assumed that the input is A = (a0, a1, a2, a3) ∈ (Z2 8 ) 4 , and the output is B = (b0, b1, b2, b3) ∈ (Z2 8 ) 4, the calculation process can be represented as (b0, b1, b2, b3) = τ(A) = (Sbox(a0), Sbox(a1), Sbox(a2), Sbox(a3)); the output result of the nonlinear transformation τ is taken as the input of the linear transformation L, and the input is B ∈ Z2 32 , and the output is C ∈ Z2 32 , then C = L(B) = B ⊕ (B << <<2) ⊕ (B << <<10) ⊕ (B << <<18) ⊕ (B << <<24).
[0047] The process of encrypting L0 and R0 in the first round key in the round key array by using the above-mentioned round key can be represented as L1 = R0, R1 = L0 ⊕ (R0 ⊕ K), K representing a group of round keys used for the first encryption operation, and the round key used for each round of encryption operation being different; then a group of values obtained after 16 rounds of encryption operation is L 16 = R 15 , R 16 = L 15 ⊕ (R 15 ⊕ K), at this time K is a group of round keys used for the last encryption operation. Combining L 16 and R 16 obtained, the initial encrypted information segment corresponding to each information segment can be obtained.
[0048] S130, according to the preset permutation table, the numerical position of each initial encrypted information segment is replaced to obtain the corresponding permutation information segment.
[0049] According to the preset permutation table, the numerical position of each initial encrypted information segment is replaced to obtain the corresponding permutation information segment. After obtaining the initial encrypted information segment, the numerical position of the initial encrypted information segment can be replaced, and the specific way of replacing the numerical position by using the configuration table is as shown in the above steps.
[0050] In specific embodiments, step S130 includes the sub-steps of: obtaining the permutation position corresponding to each position in the initial encrypted information segment according to the permutation table; and replacing the numerical position of each position in the initial encrypted information segment according to the permutation position to obtain the corresponding permutation information segment.
[0051] Firstly, the initial encryption information segment is replaced by the substitution table to obtain the corresponding substitution position of each position, such as the first number value in the initial encryption information segment corresponds to the fifth row and the eighth column according to the above substitution table. The number value of each position in the initial encryption information segment is replaced according to the substitution position, that is, the number value of each position in the initial encryption information segment is filled into the corresponding substitution position, so as to obtain the substitution information segment. The number value contained in the substitution information segment is the same as that contained in the initial encryption information segment, only the position between the number values is replaced.
[0052] S140, each of the substitution information segments is respectively split into first and second segments with equal length. Each of the substitution information segments is respectively split into first and second segments with equal length. The substitution information segment is split into two segments again, and each substitution information segment can be split into a first segment and a second segment, and the length of the first segment and the second segment is equal, and each is 32 bits.
[0053] S150, according to the preset second key and encryption strategy, the first segment and the second segment are respectively encrypted in multiple rounds to obtain the corresponding first encrypted segment and second encrypted segment.
[0054] According to the preset second key and encryption strategy, the first segment and the second segment are respectively encrypted in multiple rounds to obtain the corresponding first encrypted segment and second encrypted segment. Further, the first segment and the second segment can be respectively encrypted in multiple rounds according to the second key and the encryption strategy. After the first segment is encrypted in multiple rounds, the first encrypted segment is obtained, and after the second segment is encrypted in multiple rounds, the second encrypted segment is obtained.
[0055] In a specific embodiment, the step S150 comprises the sub-steps of: obtaining a preliminary segment key from the second key as a previous segment key to perform XOR operation on the first segment and the second segment respectively to obtain corresponding first XOR operation segment and second XOR operation segment; performing character replacement on the first XOR operation segment and the second XOR operation segment according to the sandbox configured in the encryption strategy to obtain a first replacement segment and a second replacement segment; performing confusion operation on the first replacement segment and the second replacement segment according to the confusion operation rule in the encryption strategy to obtain corresponding first confusion segment and second confusion segment; performing round key XOR operation on the first confusion segment and the second confusion segment according to the sequence to obtain corresponding first operation segment and second operation segment; the subsequent segment key is a segment key after the previous segment key; taking the first operation segment and the second operation segment as the first XOR operation segment and the second XOR operation segment respectively, and taking the current subsequent segment key as the previous segment key to return to perform the step of performing character replacement on the first XOR operation segment and the second XOR operation segment according to the sandbox configured in the encryption strategy until the subsequent segment key cannot be obtained from the second key, and then outputting the first operation segment and the second operation segment obtained as the first encrypted segment and the second encrypted segment.
[0056] The preliminary segment key (first segment key) can be obtained from the second key as the previous segment key, and XOR operation is performed on the first segment and the second segment by the previous segment key to obtain corresponding first XOR operation segment and second XOR operation segment. The second key is a 128-bit key, and the characters in positions 0-15 are obtained as the previous segment key for use.
[0057] The characters in the first XOR operation segment and the second XOR operation segment are replaced according to the sandbox configured in the encryption strategy. Specifically, the sandbox (such as S-box) includes two 16x16 two-dimensional constant arrays, and the position of each value in the XOR operation segment (first XOR operation segment or second XOR operation segment) is determined according to the first two-dimensional constant array, such as determining that the position of one value is a 2,2 , the XOR operation segment is 32 bits, and the value corresponding to the position a 2,2 in the other two-dimensional constant array is obtained to replace the original value, so as to realize character replacement of each XOR operation segment. For example, the corresponding position in the other two-dimensional constant array is b 2,2 , and the character corresponding to the position b 2,2 is "1", so the value at the original position is replaced by "1".
[0058] According to the confusion operation rule, the first replacement segment and the second replacement segment are respectively subjected to confusion operation, and first confusion segment and the second confusion segment obtained after the confusion operation are respectively subjected to XOR operation with a round key, where the encryption uses the latter segment key in the second key. If the former segment key is 0-15 bits, then the latter segment key is 16-31 bits. Specifically, the latter segment key can be combined with the original latter segment key in reverse to obtain a group of 4-byte keys for use. The obtained keys are used for XOR operation on the first confusion segment and the second confusion segment, and the XOR operation result is subjected to multiple rounds of XOR operation using the key, and after 10 cycles, the corresponding first operation segment and the second operation segment are obtained.
[0059] If another latter segment key can be sequentially obtained from the second key, the first operation segment is taken as the first XOR operation segment, the second operation segment is taken as the second XOR operation segment, the current latter segment key is taken as the former segment key, and a new latter segment key is obtained, and then the above-mentioned character replacement step is executed. That is, the above-mentioned step needs to be executed for 7 times. Until another segment key cannot be sequentially obtained from the second key, the latest obtained first operation segment and the second operation segment are taken as the first encrypted segment and the second encrypted segment for output.
[0060] In specific embodiments, the first replacement segment and the second replacement segment are respectively subjected to confusion operation according to the confusion operation rule in the encryption strategy to obtain corresponding first confusion segment and second confusion segment, including: the first replacement segment and the second replacement segment are respectively subjected to row displacement processing according to the displacement value in the confusion operation rule to obtain corresponding first row displacement segment and second row displacement segment; the first row displacement segment and the second row displacement segment are respectively subjected to matrix multiplication according to the fixed matrix in the confusion operation rule to obtain corresponding first state matrix and second state matrix; the elements in the first state matrix and the elements in the second state matrix are respectively subjected to byte mapping according to the mapping table in the confusion operation rule to obtain corresponding first confusion segment and second confusion segment.
[0061] Specifically, the first replacement segment and the second replacement segment are both 32 bits and can also be converted into an 8x4 two-dimensional array, and the confusion operation includes: the first replacement segment and the second replacement segment are respectively subjected to row displacement according to the displacement value in the confusion operation rule, that is, the data in each row of the 16x16 two-dimensional array corresponding to the replacement segment is subjected to displacement. For example, if 2-bit displacement to the right is performed, then the data in the first position of each row is displaced to the third position of the row, the data in the 15th position of each row is displaced to the first position of the row, and the data in the 16th position of each row is displaced to the second position of the row.
[0062] The first row displacement segment and the row displacement segment obtained by performing row displacement are multiplied by a matrix, for example, a fixed matrix two-dimensional constant array is used as a fixed matrix, and the two-dimensional numerical values corresponding to each row displacement segment are multiplied by the fixed matrix to obtain a corresponding first state matrix and a second state matrix. According to the mapping table in the confusion operation rule, the elements in the first state matrix and the elements in the second state matrix are byte-mapped, that is, the elements in each state matrix are remapped to a new byte according to the mapping table, and then each state matrix after mapping can obtain a confusion segment, and the first confusion segment corresponds to the first state matrix, and the second confusion segment corresponds to the second state matrix.
[0063] S160, according to the preset compression rule, the first encrypted segment and the second encrypted segment are compressed respectively to obtain corresponding first compressed segment and second compressed segment.
[0064] According to the preset compression rule, the first encrypted segment and the second encrypted segment are compressed respectively to obtain corresponding first compressed segment and second compressed segment. Further, according to the compression rule, the first encrypted segment and the second encrypted segment are compressed respectively to obtain the first compressed segment and the second compressed segment after compression.
[0065] In a specific embodiment, step S160 includes the following sub-steps: the first encrypted segment and the second encrypted segment are respectively split into corresponding segment arrays; each segment array is expanded by an expansion operation formula configured in the compression rule to obtain a corresponding permutation array; a positioning array is obtained from each row of information in each permutation array; a conversion character corresponding to each positioning array in each permutation array is obtained from a character table configured in the compression rule; and the conversion characters of the segment array corresponding to the first encrypted segment and the conversion characters of the segment array corresponding to the second encrypted segment are combined respectively to obtain the first compressed segment and the second compressed segment.
[0066] The first encrypted segment and the second encrypted segment are each a 128-bit data. First, the first encrypted segment and the second encrypted segment are respectively split into four 32-bit data to obtain corresponding segment arrays. Each 32-bit segment array can be divided into 8 rows and 4 columns. The first two bits of each row are operated by an expansion operation formula to obtain a new data added to the head of the row, and the last two bits of each row are operated by an expansion operation formula to obtain a new data added to the tail of the row, thereby expanding to obtain a permutation array of 8 rows and 6 columns. The expansion operation formula can be addition, multiplication, XOR, etc.
[0067] Further, the positioning array is obtained from each row of information in the permutation array. Specifically, the first bit and the last bit of each row are obtained, combined to serve as the row number, and the middle four bits of each row are combined to serve as the column number. The row number and the column number are combined to serve as the positioning array. The conversion character corresponding to the position of each positioning array is obtained from the character table. Each conversion character is a binary number. After conversion, each segment array can correspond to an 8-bit array. Each encrypted segment can correspond to a 32-bit string after compression, serving as the obtained compressed segment. After compression, the first encrypted segment becomes a 32-bit string, serving as the first compressed segment. After compression, the second encrypted segment becomes a 32-bit string, serving as the second compressed segment.
[0068] S170, according to the compression rule and the preset permutation rule, the numerical value of the second compressed segment is permuted to obtain the corresponding permutation segment.
[0069] According to the compression rule and the preset permutation rule, the numerical value of the second compressed segment is permuted to obtain the corresponding permutation segment. According to the compression rule and the permutation rule, the numerical value of the second compressed segment is permuted to obtain the corresponding permutation segment.
[0070] In specific embodiments, step S170 includes the following sub-steps: according to the expansion operation, the segment array corresponding to the second compressed segment is expanded to obtain the corresponding expansion array; the expansion array is permuted once through the first S-box configured in the permutation rule to obtain the corresponding initial permutation segment; the initial permutation segment is permuted again through the second S-box configured in the permutation rule to obtain the corresponding permutation segment.
[0071] Specifically, the expansion operation in the compression rule can also be used to expand the segment array corresponding to the second compressed segment to obtain the expansion array. The specific processing process is the same as described above. Further, the expansion array is permuted once through the first S-box configured in the permutation rule. For example, the expansion value is permuted once through the S-box permutation operation to obtain the initial permutation segment. Further, the initial permutation segment is permuted again through the second S-box configured in the permutation rule. For example, the initial permutation segment is permuted again through the P-box permutation operation to obtain the corresponding permutation segment.
[0072] S180, the first compressed segment is taken as a new first segment, the added segment is taken as a new second segment, and the execution of the multi-round cyclic encryption of the first segment and the second segment according to the preset second key and the encryption strategy is returned. Until the number of cycles of execution is greater than the preset number threshold, the first compressed segment and the permutation segment are output as the final encrypted information segment corresponding to the permutation information segment.
[0073] The first compressed segment is taken as a new first segment, the added segment is taken as a new second segment, and the multi-round cyclic encryption of the first segment and the second segment is performed according to the preset second key and the encryption strategy, until the number of cyclic execution is greater than the preset number threshold, and then the first compressed segment and the permutation segment are output as the final encrypted information segment corresponding to the permutation information segment. The added segment is obtained by adding the permutation segment and the first compressed segment.
[0074] The number of cyclic execution of steps S150 to S170 is judged whether it is greater than the preset number threshold, if yes, step S150 is not returned to be executed; if no, the first compressed segment is taken as a new first segment, the added segment obtained by adding the permutation segment and the first compressed segment is taken as a new second segment, and step S150 is returned to be executed. If step S150 is not returned to be executed, the final encrypted information segment corresponding to each information segment is combined to obtain the encrypted information corresponding to the information to be encrypted.
[0075] S190, the final encrypted information segment corresponding to each information segment is combined to obtain the encrypted information corresponding to the information to be encrypted.
[0076] The final encrypted information segment corresponding to each information segment is sequentially combined, that is, the combination order of the final encrypted information segment is the same as the arrangement order of each information segment, and the encrypted information corresponding to the information to be encrypted can be obtained after combination. The decryption process of the encrypted information is the reverse process of the above steps.
[0077] The data reinforcement encryption method disclosed in the above embodiment includes: segmenting and encrypting the information to be encrypted by a first key to obtain initial encrypted information segments, performing numerical position permutation and equal-length splitting on the initial encrypted information segments, performing multi-round cyclic encryption on the first segment and the second segment obtained by splitting according to a second key and an encryption strategy, performing compression and numerical permutation to obtain a permutation segment, adding the permutation segment and the first compressed segment, and combining the first compressed segment to iteratively perform the above encryption operation, and combining the final encrypted information segment corresponding to each information segment into encrypted information. The above method performs initial encryption by a first key, performs multi-round cyclic encryption by a second key, and then performs compression and numerical permutation processing, thereby strengthening the encryption process through two encryption operations. The improved encryption processing method cannot be cracked in a short time, and the security of the encrypted information obtained by encryption is greatly improved.
[0078] The embodiment of the application also provides a data reinforcement encryption device which can be configured in a terminal device, and the data reinforcement encryption device is used to execute any one of the above data reinforcement encryption methods. Specifically, please refer to Figure 2 ,Figure 2 A schematic block diagram of a data reinforced encryption device is provided for an embodiment of the present application.
[0079] As shown in Figure 2 Fig. 1, the data reinforced encryption device 100 comprises an information splitting unit 110, an initial encryption processing unit 120, a numerical position permutation unit 130, a splitting unit 140, a round encryption unit 150, a compression processing unit 160, a numerical permutation unit 170, a final encrypted segment obtaining unit 180 and a final encrypted segment combining unit 190.
[0080] The information splitting unit 110 is configured to split the inputted information to be encrypted into a plurality of information segments according to a preset string length if the information to be encrypted is received;
[0081] The initial encryption processing unit 120 is configured to perform initial encryption on each information segment by using a preset first secret key, so as to obtain an initial encrypted information segment corresponding to each information segment;
[0082] The numerical position permutation unit 130 is configured to perform numerical position permutation on each initial encrypted information segment according to a preset permutation table, so as to obtain a corresponding permutation information segment;
[0083] The splitting unit 140 is configured to split each permutation information segment into a first segment and a second segment with equal length;
[0084] The round encryption unit 150 is configured to perform multi-round round encryption on the first segment and the second segment according to a preset second secret key and encryption strategy, so as to obtain a corresponding first encrypted segment and a second encrypted segment;
[0085] The compression processing unit 160 is configured to perform compression processing on the first encrypted segment and the second encrypted segment according to a preset compression rule, so as to obtain a corresponding first compressed segment and a second compressed segment;
[0086] The numerical permutation unit 170 is configured to perform numerical permutation on the second compressed segment according to the compression rule and a preset permutation rule, so as to obtain a corresponding permutation segment;
[0087] The final encrypted segment obtaining unit 180 is configured to take the first compressed segment as a new first segment, take a sum segment as a new second segment, and return to perform multi-round round encryption on the first segment and the second segment according to a preset second secret key and encryption strategy, until the number of round execution is greater than a preset number threshold, so as to output the first compressed segment and the permutation segment as a final encrypted information segment corresponding to the permutation information segment; the sum segment is obtained by adding the permutation segment and the first compressed segment;
[0088] The final encryption segment combination unit 190 is configured to combine the final encrypted information segments corresponding to each information segment to obtain the encrypted information corresponding to the information to be encrypted.
[0089] The data reinforcement encryption device provided in the embodiment of the present application applies the data reinforcement encryption method, segments the information to be encrypted by using a first secret key to obtain initial encrypted information segments, performs numerical position permutation on the initial encrypted information segments and splits the initial encrypted information segments into equal lengths, performs multi-round cyclic encryption on the first segment and the second segment split according to a second secret key and an encryption strategy, performs compression and numerical permutation to obtain permutation segments, adds the permutation segments and the first compressed segments, and iteratively performs the foregoing encryption operation after combination to obtain final encrypted information segments corresponding to each information segment and then combines the final encrypted information segments to obtain encrypted information. The method described above performs initial encryption by using a first secret key, performs multi-round cyclic encryption by using a second secret key, and then performs compression and numerical permutation processing, thereby strengthening the encryption process through two encryption operations. The improved encryption processing manner cannot be cracked in a short time, and the security of the encrypted information obtained by encryption is greatly improved.
[0090] The data reinforcement encryption device described above can be implemented in the form of a computer program, which can run on a computer device as shown in the accompanying drawings. Figure 3
[0091] Please refer to Figure 3 , Figure 3 is a schematic block diagram of a computer device provided in the embodiment of the present application. The computer device can be a terminal device for performing a data reinforcement encryption method to realize encryption processing on information to be encrypted.
[0092] Please refer to Figure 3 , the computer device 500 includes a processor 502, a memory, and a communication interface 505 connected through a communication bus 501, wherein the memory can include a storage medium 503 and an internal memory 504.
[0093] The storage medium 503 can store an operating system 5031 and a computer program 5032. The computer program 5032, when executed, can enable the processor 502 to perform a data reinforcement encryption method, wherein the storage medium 503 can be a volatile storage medium or a non-volatile storage medium.
[0094] The processor 502 is configured to provide computing and control capabilities to support the operation of the entire computer device 500.
[0095] The internal memory 504 provides an environment for the execution of the computer program 5032 in the storage medium 503, and the computer program 5032, when executed by the processor 502, can enable the processor 502 to perform a data reinforcement encryption method.
[0096] The communication interface 505 is configured to perform network communication, such as providing transmission of data information, etc. Figure 3 The structure shown in FIG. 5 is only a block diagram of part of the structure related to the scheme of the present application, and does not constitute a limitation on the computer device 500 to which the scheme of the present application is applied. Specifically, the computer device 500 can include more or fewer components than those shown in the figure, or combine certain components, or have a different arrangement of components.
[0097] The processor 502 is configured to run the computer program 5032 stored in the memory, so as to implement the corresponding functions in the data reinforcement encryption method described above.
[0098] Those skilled in the art can understand that the computer device shown in FIG. 5 is only a specific implementation of the computer device, and the scheme of the present application is not limited to the computer device shown in FIG. 5. Specifically, the computer device can include more or fewer components than those shown in the figure, or combine certain components, or have a different arrangement of components. Figure 3 The embodiments of the computer device shown in FIG. 5 do not constitute a limitation on the specific structure of the computer device. In other embodiments, the computer device can include more or fewer components than those shown in the figure, or combine certain components, or have a different arrangement of components. For example, in some embodiments, the computer device can only include the memory and the processor. In such embodiments, the structure and functions of the memory and the processor are consistent with those of the memory 501 and the processor 502 shown in the embodiments, and will not be described here. Figure 3 The embodiments of the computer device shown in FIG. 5 do not constitute a limitation on the specific structure of the computer device. In other embodiments, the computer device can include more or fewer components than those shown in the figure, or combine certain components, or have a different arrangement of components. For example, in some embodiments, the computer device can only include the memory and the processor. In such embodiments, the structure and functions of the memory and the processor are consistent with those of the memory 501 and the processor 502 shown in the embodiments, and will not be described here.
[0099] It should be understood that, in the embodiments of the present application, the processor 502 can be a central processing unit (CPU), and can also be other general-purpose processors, digital signal processors (DSP), application specific integrated circuits (ASIC), field-programmable gate arrays (FPGA) or other programmable logic devices, discrete gates or transistor logic components, discrete hardware components, etc. The general-purpose processor can be a microprocessor or any conventional processor.
[0100] In another embodiment of the present application, a computer readable storage medium is provided. The computer readable storage medium can be a volatile or non-volatile computer readable storage medium. The computer readable storage medium stores a computer program, wherein the computer program is executed by a processor to implement the steps included in the data reinforcement encryption method described above.
[0101] Those skilled in the art can clearly understand that, for the convenience and brevity of description, the specific working processes of the devices, apparatuses and units described above can refer to the corresponding processes in the foregoing method embodiments, which will not be repeated here. Those of ordinary skill in the art can realize that the units and algorithm steps of each example described in combination with the embodiments disclosed herein can be realized in electronic hardware, computer software or a combination of both. In order to clearly illustrate the interchangeability of hardware and software, each example has been described in the foregoing description in terms of its general functionality, without regard to its specific combination of hardware and software. Whether the functions are performed in hardware or software depends on the specific application and design constraints of the technical solution. A person skilled in the art can use different methods to implement the described functions for each specific application, but such implementation should not be considered beyond the scope of the present application.
[0102] In several embodiments provided by the present application, it should be understood that the disclosed devices, apparatuses and methods can be implemented in other ways. For example, the apparatus embodiments described above are merely schematic, for example, the division of the units is merely logical functional division, and actual implementation can have another division, or units with the same function can be combined into one unit, for example, multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. In addition, the coupling or direct coupling or communication connection between the units shown or discussed can be indirect coupling or communication connection through some interfaces, devices or units, or can be electrical, mechanical or other form of connection.
[0103] The units described as separate components can or can not be physically separated, and the components shown as units can or can not be physical units, i.e. they can be located in one place or distributed on multiple network units. Some or all of the units can be selected according to actual needs to achieve the purpose of the embodiments of the present application.
[0104] In addition, each functional unit in each embodiment of the present application can be integrated into a processing unit, or each unit can exist physically separately, or two or more units can be integrated into one unit. The integrated unit can be realized in the form of hardware or software functional unit.
[0105] The integrated unit, if implemented in the form of a software function unit and sold or used as an independent product, can be stored in a computer readable storage medium. Based on such understanding, the technical solutions of the present application or the whole or part of the technical solutions that essentially contribute to the prior art can be embodied in the form of a software product. The computer software product is stored in a computer readable storage medium and includes a plurality of instructions for causing a computer device (which can be a personal computer, a server, or a network device, etc.) to execute all or part of the steps of the method described in various embodiments of the present application. The aforementioned computer readable storage medium includes a U disk, a mobile hard disk, a read-only memory (ROM), a magnetic disk or an optical disk, and various media that can store program codes.
[0106] The above is only a specific implementation of the present application, but the protection scope of the present application is not limited thereto. Any person skilled in the art can easily think of various equivalent modifications or replacements within the technical scope disclosed by the present application, and these modifications or replacements should be covered within the protection scope of the present application. Therefore, the protection scope of the present application should be subject to the protection scope of the claims.
Claims
1. A method of data hardening encryption, comprising: The method comprises: If the input information to be encrypted is received, the information to be encrypted is split into multiple information segments according to a preset string length; Each information segment is initially encrypted by a preset first secret key to obtain an initial encrypted information segment corresponding to each information segment; Each initial encrypted information segment is subjected to numerical position permutation according to a preset permutation table to obtain a corresponding permutation information segment; Each permutation information segment is split into a first segment and a second segment with equal lengths; The first segment and the second segment are subjected to multi-round cyclic encryption according to a preset second secret key and an encryption strategy to obtain a first encrypted segment and a second encrypted segment; The first encrypted segment and the second encrypted segment are subjected to compression processing according to a preset compression rule to obtain a first compressed segment and a second compressed segment; The second compressed segment is subjected to numerical permutation according to the compression rule and a preset permutation rule to obtain a permutation segment; The first compressed segment is taken as a new first segment, an addition segment is taken as a new second segment, and the multi-round cyclic encryption of the first segment and the second segment according to the preset second secret key and the encryption strategy is performed again until the number of cyclic execution times is greater than a preset number threshold, and the first compressed segment and the permutation segment are output as final encrypted information segments corresponding to the permutation information segment; the addition segment is obtained by adding the permutation segment and the first compressed segment; The final encrypted information segments corresponding to each information segment are combined to obtain encrypted information corresponding to the information to be encrypted.
2. The data hardening encryption method of claim 1, wherein, The information to be encrypted is split into multiple information segments corresponding to the string length; The information to be encrypted is split into multiple information segments corresponding to the string length; It is judged whether the number of characters of the last information segment is equal to the string length; If the number of characters of the last information segment is not equal to the string length, the information segment is padded to obtain a padded information segment.
3. The data hardening encryption method of claim 1, wherein, The numerical position permutation of each initial encrypted information segment according to the preset permutation table to obtain a corresponding permutation information segment comprises: The permutation position corresponding to each position in the initial encrypted information segment is obtained according to the permutation table; The numerical position of each position in the initial encrypted information segment is subjected to position permutation according to the permutation position to obtain a corresponding permutation information segment.
4. The data hardening encryption method of claim 1, wherein, The multi-round cyclic encryption of the first segment and the second segment according to the preset second secret key and the encryption strategy to obtain a first encrypted segment and a second encrypted segment comprises: The first segment and the second segment are subjected to exclusive OR operation by taking the initial segment secret key in the second secret key as a front segment secret key to obtain a first exclusive OR operation segment and a second exclusive OR operation segment; The first exclusive OR operation segment and the second exclusive OR operation segment are subjected to character replacement according to a sandbox configured in the encryption strategy to obtain a first replacement segment and a second replacement segment; According to the confusion operation rule in the encryption strategy, the first replacement segment and the second replacement segment are subjected to confusion operation respectively, to obtain corresponding first confusion segment and second confusion segment; According to the order, the last segment key in the second key is acquired to perform round key XOR operation on the first confusion segment and the second confusion segment respectively, to obtain corresponding first operation segment and second operation segment; the last segment key is a segment key after the previous segment key; The first operation segment and the second operation segment are taken as first XOR operation segment and second XOR operation segment respectively, the current last segment key is taken as the previous segment key, and the step of performing character replacement on the first XOR operation segment and the second XOR operation segment respectively according to the sandbox configured in the encryption strategy is returned to execute, until the last segment key cannot be acquired from the second key, then the current obtained first operation segment and second operation segment are taken as first encryption segment and second encryption segment to output.
5. The data hardening encryption method of claim 4, wherein, According to the confusion operation rule in the encryption strategy, the first replacement segment and the second replacement segment are subjected to confusion operation respectively, to obtain corresponding first confusion segment and second confusion segment, including: According to the displacement value in the confusion operation rule, the first replacement segment and the second replacement segment are subjected to row displacement processing respectively, to obtain corresponding first row displacement segment and second row displacement segment; According to the fixed matrix in the confusion operation rule, the first row displacement segment and the second row displacement segment are subjected to matrix multiplication respectively, to obtain corresponding first state matrix and second state matrix; According to the mapping table in the confusion operation rule, the elements in the first state matrix and the elements in the second state matrix are subjected to byte mapping respectively, to obtain corresponding first confusion segment and second confusion segment.
6. The data hardening encryption method of claim 1, wherein, According to the preset compression rule, the first encryption segment and the second encryption segment are subjected to compression processing respectively, to obtain corresponding first compression segment and second compression segment, including: The first encryption segment and the second encryption segment are respectively split into corresponding segment arrays; According to the expansion operation formula configured in the compression rule, each segment array is subjected to expansion, to obtain corresponding permutation array by permutation; From each row of information in each permutation array, a positioning array is acquired; From the character table configured in the compression rule, a conversion character corresponding to each positioning array in each permutation array is acquired; The conversion characters of the segment array corresponding to the first encryption segment and the conversion characters of the segment array corresponding to the second encryption segment are respectively combined, to obtain corresponding first compression segment and second compression segment.
7. The data hardening encryption method of claim 6, wherein, According to the compression rule and the preset permutation rule, the second compression segment is subjected to numerical permutation, to obtain corresponding permutation segment, including: According to the expansion operation formula, the segment array corresponding to the second compression segment is subjected to expansion, to obtain corresponding expansion array by permutation; According to the first sandbox configured in the permutation rule, the expansion array is subjected to permutation once, to obtain corresponding initial permutation segment; The initial permutation segment is permuted again by a second sandbox configured in the permutation rule to obtain a corresponding permutation segment.
8. A data hardening encryption device, comprising: The data reinforcement encryption device is used for executing the data reinforcement encryption method in any one of claims 1-7, and the device comprises: An information splitting unit is configured to split the inputted information to be encrypted into a plurality of information segments according to a preset string length if the information to be encrypted is received; An initial encryption processing unit is configured to initially encrypt each information segment by a preset first secret key to obtain an initial encryption information segment corresponding to each information segment; A numerical position permutation unit is configured to perform numerical position permutation on each initial encryption information segment according to a preset permutation table to obtain a corresponding permutation information segment; A splitting unit is configured to split each permutation information segment into a first segment and a second segment with equal length; A cyclic encryption unit is configured to perform multi-round cyclic encryption on the first segment and the second segment according to a preset second secret key and encryption strategy to obtain a corresponding first encryption segment and second encryption segment; A compression processing unit is configured to perform compression processing on the first encryption segment and the second encryption segment according to a preset compression rule to obtain a corresponding first compression segment and second compression segment; A numerical permutation unit is configured to perform numerical permutation on the second compression segment according to the compression rule and a preset permutation rule to obtain a corresponding permutation segment; A final encryption segment acquisition unit is configured to take the first compression segment as a new first segment, take a sum segment as a new second segment, and return to perform multi-round cyclic encryption on the first segment and the second segment according to a preset second secret key and encryption strategy until the number of cyclic execution times is greater than a preset number threshold, and then output the first compression segment and the permutation segment as a final encryption information segment corresponding to the permutation information segment; the sum segment is obtained by adding the permutation segment and the first compression segment; A final encryption segment combination unit is configured to combine the final encryption information segment corresponding to each information segment to obtain encryption information corresponding to the information to be encrypted.
9. A computer device, comprising: The device comprises a processor, a communication interface, a memory and a communication bus, wherein the processor, the communication interface and the memory complete communication with each other through the communication bus; The memory is used for storing a computer program; The processor is used for executing the program stored on the memory to realize the steps of the data reinforcement encryption method in any one of claims 1-7.
10. A computer-readable storage medium having stored thereon a computer program, characterized in that, The computer program is executed by the processor to realize the steps of the data reinforcement encryption method in any one of claims 1-7.
Citation Information
Patent Citations
Information transmission method and device based on fragment encrypted storage, equipment and medium
CN116346508A
Cryptographic transformation method and device for its implementation
RU2738321C1