A data encryption method
By splitting text data into odd and even bit matrices and performing row/column cyclic shifting and fractal offset, a dynamic key is generated during the encryption process, which solves the problems of single encryption dimension and static key in existing encryption methods and improves encryption security.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- SICHUAN BOCHUANGHUI FRONTIER TECH CO LTD
- Filing Date
- 2026-01-21
- Publication Date
- 2026-04-24
AI Technical Summary
Existing text encryption methods have a single encryption dimension, shallow perturbation level, and static key structure, making them easy for attackers to crack and resulting in low security.
The text data is converted into binary code, split into odd and even bits, and an odd and even bit matrix is constructed. A fractal offset key is generated by cyclic shifting of rows and columns, and XOR processing is performed to generate an odd and even part encryption hybrid enhancement matrix. Finally, the ciphertext is restored according to the odd and even bits.
Completely severing the statistical correlation between ciphertext and plaintext enhances the ability to resist statistical analysis and correlation inference attacks, realizes dynamic association between key and input data, and improves encryption security.
Smart Images

Figure CN121567295B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of text encryption technology, and more specifically to a data encryption method. Background Technology
[0002] With the continuous expansion of network communication and data exchange, text data frequently flows between different systems. To prevent sensitive information from being illegally obtained during transmission or storage, data encryption has become a crucial security measure. Among existing text encryption methods, a common approach is to divide the plaintext into fixed-length blocks and then rearrange the character positions within each block using a pre-defined permutation table or static key, thereby scrambling the original data order. This method is simple in structure, low in implementation cost, and widely used in some basic scenarios.
[0003] However, existing fixed permutation encryption has two major technical flaws:
[0004] First, the encryption dimension is singular and the perturbation level is shallow, relying only on character position rearrangement without touching the perturbation of bit-level data features, resulting in the algorithm's limited ability to perturb data features. At the same time, there is a lack of effective correlation between the key structure and the input data, making it easy for the ciphertext to form stable statistical features (such as character frequency and position distribution correlation). Some features of the original data are still reflected in the ciphertext, making it difficult to resist attack methods such as statistical analysis and correlation inference.
[0005] Secondly, the key system is static, and the preset key is not directly related to the input data. Once the key is leaked or brute-forced, attackers can directly reuse the key to crack batches of data, causing the entire encryption system to fail immediately. Summary of the Invention
[0006] In view of the above-mentioned shortcomings in the prior art, the present invention provides a data encryption method that solves the problem of low encryption security in the prior art.
[0007] To achieve the above-mentioned objectives, the technical solution adopted by this invention is: a data encryption method, comprising the following steps:
[0008] The text data is converted into binary code and split into odd bits and even bits to obtain odd bit sequences and even bit sequences, thereby constructing odd bit matrices and even bit matrices;
[0009] For each row and column of the two matrices, generate state bits, calculate row and column shifts, and perform cyclic shifts to obtain odd-shift and even-shift matrices.
[0010] Convert each row and column of the odd shift matrix and the even shift matrix into decimal to generate a numerical vector. Generate a fractal shift key vector from the numerical vector to obtain the fractal shift key vectors for odd rows, odd columns, even rows and even columns.
[0011] Each fractal offset key vector is encrypted with its corresponding numerical vector and restored to a matrix, resulting in an encryption matrix with odd rows, odd columns, even rows, and even columns.
[0012] The odd-row encryption matrix and the odd-column encryption matrix are XORed, and the even-row encryption matrix and the even-column encryption matrix are XORed. An obfuscation value is generated based on the correlation values of the odd and even parts to obtain the odd-part encryption hybrid enhancement matrix and the even-part encryption hybrid enhancement matrix.
[0013] The odd-part encryption hybrid enhancement matrix and the even-part encryption hybrid enhancement matrix are restored to sequences, and then restored according to the odd and even positions to obtain the ciphertext.
[0014] Furthermore, the process of constructing the odd-bit matrix and the even-bit matrix includes:
[0015] The text data is converted into binary code to obtain a text binary sequence. Odd and even bits are selected from the text binary sequence to obtain odd bit sequences and even bit sequences.
[0016] Both odd-bit and even-bit sequences are divided into 64-bit subsequences, resulting in multiple odd-bit subsequences and multiple even-bit subsequences.
[0017] Each odd-bit subsequence is divided into equal-length 8-bit segments to obtain multiple 8-bit odd-bit segments; each 8-bit odd-bit segment is used as a row vector of a matrix to form an 8×8 odd-bit matrix.
[0018] Each even-bit subsequence is divided into equal-length 8-bit segments to obtain multiple 8-bit even-bit segments; each 8-bit even-bit segment is used as a row vector of a matrix to form an 8×8 even-bit matrix.
[0019] Furthermore, the process of performing a cyclic shift includes:
[0020] Perform a bitwise XOR operation on each row of the matrix to obtain the row state bits, and then construct a row state vector from the row state bits.
[0021] Perform a bitwise XOR operation on each column of the matrix to obtain the column state bits, and then construct a column state vector from the column state bits.
[0022] XOR the row state vector with each row in the matrix to obtain the shift vector of each row, generate the shift amount of each row, and perform cyclic shift on the corresponding row in the matrix to obtain the initial cyclic shift matrix.
[0023] XOR the column state vector with each column in the matrix to obtain the shift vector of each column, generate the shift amount of each column, and perform cyclic shifting on the corresponding columns in the initial cyclic shift matrix to obtain the shift matrix.
[0024] Furthermore, the formula for calculating the shift amount is: ,
[0025] Where S is the shift amount. Let i be the i-th binary element in the shift vector. For the modulo operation, i is a positive integer.
[0026] Furthermore, the process of generating numerical vectors includes:
[0027] Convert each row of the odd shift matrix to decimal to obtain the row value, and then construct the odd row value vector from the row values.
[0028] Convert each column of the odd shift matrix to decimal to obtain the column value, and construct an odd column value vector from the column values.
[0029] Convert each row of the even shift matrix to decimal to obtain the row value, and then construct an even row numerical vector from the row values.
[0030] Convert each column of the even shift matrix to decimal to obtain the column values, and then construct an even column numerical vector from the column values.
[0031] Furthermore, the process of generating the fractal offset key vector includes:
[0032] In a numerical vector, the maximum value is subtracted from the minimum value, and the result is divided by the number of elements in the numerical vector to obtain the fractal scaling index.
[0033] The fractal scaling value is obtained by calculating the difference between each element in the numerical vector and the minimum value, and by using the power operation of the fractal scaling exponent.
[0034] In a numerical vector, the mean of each element is calculated to obtain the vector mean.
[0035] The numerical offset vector is obtained by subtracting the mean of the vector from each element of the numerical vector;
[0036] Generate key operation factors based on the numerical offset vector;
[0037] Based on the key operation factor and fractal scaling value, and using the key generation model, the fractal offset key vector is obtained.
[0038] Furthermore, the formula for obtaining the fractal scaling value is: ,
[0039] in, For the first A fractal scaling value, For the numerical vector, the first One element, To be the minimum value, The fractal scaling index, It is a positive integer;
[0040] The formula for generating the key operation factor is: ,
[0041] in, For the first One key operation factor, The first in the numerical offset vector One element, It is a cubic constant. It is a constant for the linear term;
[0042] The formula for the key generation model is: ,
[0043] in, The fractal offset key vector is the first... One key value, The fractal offset key vector is the first... One key value, This is the modulo operation.
[0044] Furthermore, the process of obtaining the odd-part encryption hybrid enhancement matrix and the even-part encryption hybrid enhancement matrix includes:
[0045] The odd-row encryption matrix and the odd-column encryption matrix are XORed to obtain the odd-part encryption enhancement matrix, and the even-row encryption matrix and the even-column encryption matrix are XORed to obtain the even-part encryption enhancement matrix.
[0046] Based on the correlation values of the odd-part encryption enhancement matrix and the even-part encryption enhancement matrix, confusion values are generated to obtain the odd-part encryption hybrid enhancement matrix and the even-part encryption hybrid enhancement matrix.
[0047] Furthermore, the process of obtaining the odd-part encryption hybrid enhancement matrix and the even-part encryption hybrid enhancement matrix includes:
[0048] Convert each row of the odd part encryption enhancement matrix to decimal, obtain the values of each row, and arrange them to obtain the odd part encryption enhancement vector;
[0049] Convert each row of the even-part encryption enhancement matrix to decimal, obtain the values of each row, and arrange them to obtain the even-part encryption enhancement vector.
[0050] Calculate the correlation value between the odd-part encryption enhancement vector and the even-part encryption enhancement vector to obtain the correlation vector;
[0051] Based on the relevant vectors, an obfuscation value is generated for the odd part encryption enhancement vector to obtain the odd part encryption obfuscation vector;
[0052] Based on the relevant vectors, the dual part encryption enhancement vector is used to generate a confusion value, thus obtaining the dual part encryption confusion vector;
[0053] Add the odd-part encryption confusion vector and the odd-part encryption enhancement vector, and restore them to binary to obtain the odd-part encryption hybrid enhancement matrix;
[0054] Add the even-part encryption confusion vector to the even-part encryption enhancement vector and restore it to binary to obtain the even-part encryption hybrid enhancement matrix.
[0055] Furthermore, the formula for calculating the correlation value is: ,
[0056] in, For the relevant vector, the first One relevant value, The first part of the encryption enhancement vector for the odd part A number, The mean value of the odd-part encryption enhancement vector. The even-part encryption enhancement vector of the first A number, The mean value in the even-part encryption enhancement vector;
[0057] The formula for generating the odd-part encryption confusion vector is: ,
[0058] in, The first part of the odd-part encryption obfuscation vector One obfuscation value, This is the modulo operation;
[0059] The formula for generating the even-part encryption confusion vector is: ,
[0060] in, For the even part of the encryption and confusion vector, the first An obfuscated value.
[0061] The beneficial effects of this invention are as follows:
[0062] 1. First, the text data is split into odd-bit and even-bit sequences, constructing a dual-matrix parallel processing structure to break the continuity of the original data at the bit level. Then, matrix-level and vector-level perturbations are achieved through bidirectional row / column cyclic shifts and fractal key offsets. Finally, the encryption results of the odd / even matrix rows / columns are XORed and mixed, and obfuscation values are generated based on the correlation values of the odd and even parts, further strengthening the destruction of the ciphertext correlation. Throughout the encryption process, each bit of the ciphertext is deeply bound to the odd / even bit distribution, matrix row / column state, and fractal key characteristics of the original data, completely severing the statistical correlation between the ciphertext and plaintext. This prevents attackers from reconstructing the original data through statistical analysis methods such as character frequency and bit distribution probability, significantly improving the resistance to attacks such as statistical analysis and correlation inference, and making up for the technical shortcomings of existing technologies, such as single encryption dimension and shallow perturbation level.
[0063] 2. This invention innovatively constructs a dynamic "data-key" association mechanism: the fractal offset key vector is not a preset fixed value, but is generated based on the numerical vector after the odd / even bit matrix transformation. Simultaneously, the cyclic shift amount is calculated from the matrix row / column state bits, achieving deep coupling between key parameters and input data features. Under this mechanism, the key dynamically adjusts with changes in input data. Even if an attacker obtains partial encryption parameters, they cannot reconstruct the complete key without the specific data, making it difficult to launch mass cracking or key reuse attacks. Furthermore, in the multi-level encryption process, each step's parameters are strongly correlated with the features of the preceding data, forming a chain-like association of "data-parameter-key," further enhancing the encryption system's resistance to cracking. This addresses the technical shortcomings of existing technologies, such as static keys and a lack of effective association with data, thus improving encryption security. Attached Figure Description
[0064] Figure 1 This is a flowchart of a data encryption method. Detailed Implementation
[0065] The specific embodiments of the present invention are described below to enable those skilled in the art to understand the present invention. However, it should be understood that the present invention is not limited to the scope of the specific embodiments. For those skilled in the art, various changes are obvious as long as they are within the spirit and scope of the present invention as defined and determined by the appended claims. All inventions utilizing the concept of the present invention are protected.
[0066] like Figure 1 As shown, a data encryption method includes the following steps:
[0067] The text data is converted into binary code and split into odd bits and even bits to obtain odd bit sequences and even bit sequences, thereby constructing odd bit matrices and even bit matrices;
[0068] For each row and column of the two matrices, generate state bits, calculate row and column shifts, and perform cyclic shifts to obtain odd-shift and even-shift matrices.
[0069] Convert each row and column of the odd shift matrix and the even shift matrix into decimal to generate a numerical vector. Generate a fractal shift key vector from the numerical vector to obtain the fractal shift key vectors for odd rows, odd columns, even rows and even columns.
[0070] Each fractal offset key vector is encrypted with its corresponding numerical vector and restored to a matrix, resulting in an encryption matrix with odd rows, odd columns, even rows, and even columns.
[0071] The odd-row encryption matrix and the odd-column encryption matrix are XORed, and the even-row encryption matrix and the even-column encryption matrix are XORed. An obfuscation value is generated based on the correlation values of the odd and even parts to obtain the odd-part encryption hybrid enhancement matrix and the even-part encryption hybrid enhancement matrix.
[0072] The odd-part encryption hybrid enhancement matrix and the even-part encryption hybrid enhancement matrix are restored to sequences, and then restored according to the odd and even positions to obtain the ciphertext.
[0073] In this embodiment, the process of constructing the odd-bit matrix and the even-bit matrix includes:
[0074] The text data is converted into binary code to obtain a text binary sequence. Each bit in the text binary sequence is assigned a position number. Odd and even bits are selected from the text binary sequence (i.e., odd position numbering and even position numbering) to obtain odd bit sequences and even bit sequences.
[0075] Both odd-bit and even-bit sequences are divided into 64-bit subsequences, resulting in multiple odd-bit subsequences and multiple even-bit subsequences.
[0076] Each odd-bit subsequence is divided into equal-length 8-bit segments to obtain multiple 8-bit odd-bit segments; each 8-bit odd-bit segment is used as a row vector of a matrix to form an 8×8 odd-bit matrix.
[0077] Each even-bit subsequence is divided into equal-length 8-bit segments to obtain multiple 8-bit even-bit segments; each 8-bit even-bit segment is used as a row vector of a matrix to form an 8×8 even-bit matrix.
[0078] This invention first converts text data into a binary sequence, breaks the continuity of bits by splitting odd and even bits, forms an odd bit sequence from odd bits and an even bit sequence from even bits, and then divides it into subsequences of length 64 bits, with each subsequence forming a bit matrix.
[0079] In this embodiment, the cyclic shift process for odd-bit matrices and even-bit matrices is the same, both including the following process:
[0080] Perform a bitwise XOR operation on each row of the matrix (i.e., perform a bitwise XOR operation on each element of each row) to obtain the row state bits, and then construct a row state vector from the 8 row state bits.
[0081] Perform a bitwise XOR operation on each column of the matrix (i.e., perform a bitwise XOR operation on each element of each column) to obtain the column state bits, and then construct a column state vector from the 8 column state bits.
[0082] XOR the row state vector with each row in the matrix to obtain the shift vector of each row, generate the shift amount of each row, and perform cyclic shift on the corresponding row in the matrix to obtain the initial cyclic shift matrix.
[0083] XOR the column state vector with each column vector in the matrix (here the matrix is the matrix before shifting) to obtain the shift vector of each column, generate the shift amount of each column, and perform cyclic shifting on the corresponding columns in the initial cyclic shift matrix to obtain the shift matrix.
[0084] The shift matrix corresponding to an odd-bit matrix is an odd-shift matrix, and the shift matrix corresponding to an even-bit matrix is an even-shift matrix.
[0085] This invention achieves multidimensional correlation and encryption adaptability in data processing through a two-layer state perception and dynamic shift mechanism in the row / column dimensions. On the one hand, by generating state vectors through bitwise XOR operations row by row and column by column, the calculation of shift amounts is deeply correlated with the overall data distribution characteristics of the matrix, avoiding the predictability defects caused by fixed shift patterns and significantly improving the randomness and anti-analysis capability of data processing. On the other hand, by adopting a two-layer execution logic of "row shift preprocessing - column shift optimization", the matrix elements form a complex positional mapping relationship in two-dimensional space, which not only strengthens the data obfuscation effect, but also deeply binds the shift operation with the bit characteristics of the data itself through the XOR interaction between the state vector and the original vector, effectively resisting cracking attacks based on statistical analysis.
[0086] This invention performs an XOR operation on each row / column to generate a unique shift vector for each row / column, thereby generating a unique shift amount. Each row and each column performs a different number of cyclic shifts, improving the security of data encryption.
[0087] In this embodiment, the formula for calculating the shift amount is: ,
[0088] Where S is the shift amount. Let i be the i-th binary element in the shift vector. For the modulo operation, i is a positive integer.
[0089] This invention calculates the shift amount based on the bit value of each bit in the shift vector, and uses mod8 operation to limit the shift amount to a reasonable range of 0-7, which facilitates cyclic shifting of each row and column.
[0090] In this embodiment, the process of generating a numerical vector includes:
[0091] Convert each row of the odd shift matrix to decimal to obtain the row value, and then construct the odd row value vector from the row values.
[0092] Convert each column of the odd shift matrix to decimal to obtain the column value, and construct an odd column value vector from the column values.
[0093] Convert each row of the even shift matrix to decimal to obtain the row value, and then construct an even row numerical vector from the row values.
[0094] Convert each column of the even shift matrix to decimal to obtain the column values, and then construct an even column numerical vector from the column values.
[0095] In this embodiment, the process of generating the fractal offset key vector from the four numerical vectors all includes:
[0096] In a numerical vector, the maximum value is subtracted from the minimum value, and the result is divided by the number of elements in the numerical vector to obtain the fractal scaling index.
[0097] The fractal scaling value is obtained by calculating the difference between each element in the numerical vector and the minimum value, and by using the power operation of the fractal scaling exponent.
[0098] In a numerical vector, the mean of each element is calculated to obtain the vector mean.
[0099] The numerical offset vector is obtained by subtracting the mean of the vector from each element of the numerical vector;
[0100] Generate key operation factors based on the numerical offset vector;
[0101] Based on the key operation factor and fractal scaling value, and using the key generation model, the fractal offset key vector is obtained.
[0102] The fractal offset key vector corresponding to the odd-row numerical vector is called the odd-row fractal offset key vector, the fractal offset key vector corresponding to the odd-column numerical vector is called the odd-column fractal offset key vector, the fractal offset key vector corresponding to the even-row numerical vector is called the even-row fractal offset key vector, and the fractal offset key vector corresponding to the even-column numerical vector is called the even-column fractal offset key vector.
[0103] In this embodiment, the formula for obtaining the fractal scaling value is: ,
[0104] in, For the first A fractal scaling value, For the numerical vector, the first One element, To be the minimum value, The fractal scaling index, It is a positive integer;
[0105] The formula for generating the key operation factor is: ,
[0106] in, For the first One key operation factor, The first in the numerical offset vector One element, It is a cubic constant. It is a constant for the linear term;
[0107] The formula for the key generation model is: ,
[0108] in, The fractal offset key vector is the first... One key value, The fractal offset key vector is the first... One key value, This is the modulo operation.
[0109] On the one hand, this invention constructs a multi-source numerical vector by using the row and column decimal conversion of the odd / even shift matrix, allowing the original data for key generation to be deeply bound to the bit distribution characteristics after matrix shift, thus strengthening the correlation between the key and the encrypted object from the data source. On the other hand, in the fractal offset key vector generation process, the fractal scaling value is obtained by using the difference between each element and the minimum value and the power operation of the fractal scaling exponent. Combined with the key operation factor generated based on the numerical offset vector, the generated fractal offset key vector not only utilizes the fractal characteristics to give the key output a complex nonlinear distribution, greatly improving the randomness and anti-statistical analysis capability of the key, but also associates the mean characteristics of the original data with the numerical offset vector, deeply coupling the key generation process with the statistical properties of the data itself, avoiding the predictability defects of independent keys.
[0110] The key generation model of this invention associates "original data fractal features + numerical offset features + previous key value", that is, the generation of each key value is related to the previous key value. This iterative mode of "state inheritance" makes the key sequence form a strongly correlated dynamic chain. Crackers cannot reverse the whole sequence by analyzing a single key value in isolation. Even a slight perturbation of the original data or the initial key can cause the entire key sequence to change completely, effectively resisting local cracking attempts targeting the key.
[0111] In this embodiment, the process of obtaining the encryption matrices of odd rows, odd columns, even rows, and even columns includes: multiplying the fractal offset key vector element by element with the corresponding numerical vector, taking the remainder of the multiplication result modulo 256 to obtain the encryption vector, and converting each element in the encryption vector into binary code to obtain the encryption matrix.
[0112] Specifically, this includes: multiplying the odd row fractal offset key vector and the odd row numerical vector element by element, and taking the remainder of the multiplication result divided by 256 to obtain the odd row encryption vector; converting each element in the odd row encryption vector into binary code (treating the binary code of each element as a row) to obtain the odd row encryption matrix.
[0113] Multiply the odd-column fractal offset key vector and the odd-column numerical vector element-wise, and take the remainder of the multiplication result modulo 256 to obtain the odd-column encryption vector. Convert each element in the odd-column encryption vector into binary code (treat the binary code of each element as a column) to obtain the odd-column encryption matrix.
[0114] Multiply the even-row fractal offset key vector and the even-row numerical vector element by element, and take the remainder of the multiplication result divided by 256 to obtain the even-row encryption vector. Convert each element in the even-row encryption vector into binary code (and treat the binary code of each element as a row) to obtain the even-row encryption matrix.
[0115] Multiply the even-column fractal offset key vector and the even-column numerical vector element-wise, and take the remainder of the multiplication result modulo 256 to obtain the even-column encryption vector. Convert each element in the even-column encryption vector into binary code (treat the binary code of each element as a column) to obtain the even-column encryption matrix.
[0116] This invention achieves multiplication of each numerical vector with an independent fractal offset key vector by element-wise multiplication of the fractal offset key vector, resulting in different encryption keys. After converting the fractal offset key vector into a binary matrix, the bit distribution is completely reconstructed into a complex form that is deeply coupled with the original matrix and the fractal key, which greatly improves the obfuscation level and anti-cracking ability of the data.
[0117] In this embodiment, the process of obtaining the odd-part encryption hybrid enhancement matrix and the even-part encryption hybrid enhancement matrix includes:
[0118] The odd-row encryption matrix and the odd-column encryption matrix are XORed to obtain the odd-part encryption enhancement matrix, and the even-row encryption matrix and the even-column encryption matrix are XORed to obtain the even-part encryption enhancement matrix.
[0119] Based on the correlation values of the odd-part encryption enhancement matrix and the even-part encryption enhancement matrix, confusion values are generated to obtain the odd-part encryption hybrid enhancement matrix and the even-part encryption hybrid enhancement matrix.
[0120] In this invention, the row and column encryption matrices are already bound to the row and column dimensional features of the original data respectively. Through XOR operation, the encryption features of the two dimensions can be deeply integrated, allowing the enhanced matrix to carry the obfuscation information at both the row and column levels. This avoids the feature uniformity of a single-dimensional encryption matrix and greatly improves the dimensional correlation and obfuscation complexity of the matrix data.
[0121] In this embodiment, the process of obtaining the odd-part encryption hybrid enhancement matrix and the even-part encryption hybrid enhancement matrix includes:
[0122] Convert each row of the odd part encryption enhancement matrix to decimal, obtain the values of each row, and arrange them to obtain the odd part encryption enhancement vector;
[0123] Convert each row of the even-part encryption enhancement matrix to decimal, obtain the values of each row, and arrange them to obtain the even-part encryption enhancement vector.
[0124] Calculate the correlation value between the odd-part encryption enhancement vector and the even-part encryption enhancement vector to obtain the correlation vector;
[0125] Based on the relevant vectors, an obfuscation value is generated for the odd part encryption enhancement vector to obtain the odd part encryption obfuscation vector;
[0126] Based on the relevant vectors, the dual part encryption enhancement vector is used to generate a confusion value, thus obtaining the dual part encryption confusion vector;
[0127] Add the odd-part encryption confusion vector and the odd-part encryption enhancement vector element by element (after adding, perform a modulo operation of 256 on each element), and restore them to binary (that is, convert the multiplication result to binary and put the binary of each multiplication result as a row) to obtain the odd-part encryption hybrid enhancement matrix;
[0128] Add the even-part encryption confusion vector and the even-part encryption enhancement vector element by element (after addition, perform a 256 modulo operation on each element) and restore them to binary (that is, convert the multiplication result to binary and put the binary of each multiplication result as a row) to obtain the even-part encryption hybrid enhancement matrix.
[0129] In this embodiment, the formula for calculating the correlation value is: ,
[0130] in, For the relevant vector, the first One relevant value, The first part of the encryption enhancement vector for the odd part A number, The mean value of the odd-part encryption enhancement vector. The even-part encryption enhancement vector of the first A number, The mean value in the even-part encryption enhancement vector;
[0131] The formula for generating the odd-part encryption confusion vector is: ,
[0132] in, The first part of the odd-part encryption obfuscation vector One obfuscation value, This is the modulo operation;
[0133] The formula for generating the even-part encryption confusion vector is: ,
[0134] in, For the even part of the encryption and confusion vector, the first An obfuscated value.
[0135] This invention converts the enhancement matrix into a numerical vector, calculates the correlation value between the odd-part encryption enhancement vector and the even-part encryption enhancement vector to obtain a correlation vector, generates a confusion value for the odd-part encryption enhancement vector based on the correlation vector, and generates a confusion value for the even-part encryption enhancement vector. Both the odd and even parts have independent confusion values. Adding the confusion values to the encryption enhancement vector improves the security of the text.
[0136] In this embodiment, the process of obtaining ciphertext includes: arranging the elements of each row of the odd-part encryption hybrid enhancement matrix in sequence to obtain the odd-part encryption bit sequence; arranging the elements of each row of the even-part encryption hybrid enhancement matrix in sequence to obtain the even-part encryption bit sequence; and arranging the odd-part encryption bit sequence and the even-part encryption bit sequence alternately, that is, restoring them according to the odd and even bits to obtain the ciphertext.
[0137] This invention restores the odd-part encryption hybrid enhancement matrix and the even-part encryption hybrid enhancement matrix into a sequence, and then restores it according to the odd and even bits, which not only ensures that the bit length of the ciphertext matches the original text, but also enhances security.
[0138] The above are merely preferred embodiments of the present invention and are not intended to limit the present invention. Various modifications and variations can be made to the present invention by those skilled in the art. Any modifications, equivalent substitutions, improvements, etc., made within the spirit and principles of the present invention should be included within the scope of protection of the present invention.
Claims
1. A data encryption method, characterized in that, Includes the following steps: The text data is converted into binary code and split into odd bits and even bits to obtain odd bit sequences and even bit sequences, thereby constructing odd bit matrices and even bit matrices; For each row and column of the two matrices, generate state bits, calculate row and column shifts, and perform cyclic shifts to obtain odd-shift and even-shift matrices. The process of performing a cyclic shift includes: Perform a bitwise XOR operation on each row of the matrix to obtain the row state bits, and then construct a row state vector from the row state bits. Perform a bitwise XOR operation on each column of the matrix to obtain the column state bits, and then construct a column state vector from the column state bits. XOR the row state vector with each row in the matrix to obtain the shift vector of each row, generate the shift amount of each row, and perform cyclic shift on the corresponding row in the matrix to obtain the initial cyclic shift matrix. XOR the column state vector with each column in the matrix to obtain the shift vector of each column, generate the shift amount of each column, and perform cyclic shift on the corresponding column in the initial cyclic shift matrix to obtain the shift matrix. The formula for calculating the shift amount is: , Where S is the shift amount. Let i be the i-th binary element in the shift vector. For the modulo operation, i is a positive integer; Convert each row and column of the odd shift matrix and the even shift matrix into decimal to generate a numerical vector. Generate a fractal shift key vector from the numerical vector to obtain the fractal shift key vectors for odd rows, odd columns, even rows and even columns. The process of generating a fractal offset key vector includes: In a numerical vector, the maximum value is subtracted from the minimum value, and the result is divided by the number of elements in the numerical vector to obtain the fractal scaling index. The fractal scaling value is obtained by calculating the difference between each element in the numerical vector and the minimum value, and by applying the power operation of the fractal scaling exponent. In a numerical vector, the mean of each element is calculated to obtain the vector mean. The numerical offset vector is obtained by subtracting the mean of the vector from each element of the numerical vector; Generate key operation factors based on the numerical offset vector; Based on the key operation factor and fractal scaling value, and using the key generation model, the fractal offset key vector is obtained; The formula for obtaining the fractal scaling value is: , in, For the i-th fractal scaling value, Let i be the i-th element in the numerical vector. To be the minimum value, The fractal scaling exponent is i, where i is a positive integer; The formula for generating the key operation factor is: , in, Let i be the i-th key operation factor. Let be the i-th element in the numerical offset vector, where a is the cubic constant and b is the linear constant; The formula for the key generation model is: , in, The fractal offset key vector is the first... One key value, Let i be the i-th key value in the fractal offset key vector. This is the modulo operation; Each fractal offset key vector is encrypted with its corresponding numerical vector and restored to a matrix, resulting in an encryption matrix with odd rows, odd columns, even rows, and even columns. Multiply the fractal offset key vector element-wise with the corresponding numerical vector, and take the remainder of the multiplication result modulo 256 to obtain the encryption vector. Convert each element in the encryption vector into binary code to obtain the encryption matrix. The odd-row encryption matrix and the odd-column encryption matrix are XORed, and the even-row encryption matrix and the even-column encryption matrix are XORed. An obfuscation value is generated based on the correlation values of the odd and even parts to obtain the odd-part encryption hybrid enhancement matrix and the even-part encryption hybrid enhancement matrix. The odd-part encryption hybrid enhancement matrix and the even-part encryption hybrid enhancement matrix are restored to sequences, and then restored according to the odd and even bits to obtain the ciphertext; The process of obtaining the odd-part encryption hybrid enhancement matrix and the even-part encryption hybrid enhancement matrix includes: The odd-row encryption matrix and the odd-column encryption matrix are XORed to obtain the odd-part encryption enhancement matrix, and the even-row encryption matrix and the even-column encryption matrix are XORed to obtain the even-part encryption enhancement matrix. Based on the correlation values of the odd-part encryption enhancement matrix and the even-part encryption enhancement matrix, confusion values are generated to obtain the odd-part encryption hybrid enhancement matrix and the even-part encryption hybrid enhancement matrix. The process of obtaining the odd-part encryption hybrid enhancement matrix and the even-part encryption hybrid enhancement matrix includes: Convert each row of the odd part encryption enhancement matrix to decimal, obtain the values of each row, and arrange them to obtain the odd part encryption enhancement vector; Convert each row of the even-part encryption enhancement matrix to decimal, obtain the values of each row, and arrange them to obtain the even-part encryption enhancement vector. Calculate the correlation value between the odd-part encryption enhancement vector and the even-part encryption enhancement vector to obtain the correlation vector; Based on the relevant vectors, an obfuscation value is generated for the odd part encryption enhancement vector to obtain the odd part encryption obfuscation vector; Based on the relevant vectors, the dual part encryption enhancement vector is used to generate a confusion value, thus obtaining the dual part encryption confusion vector; Add the odd-part encryption confusion vector and the odd-part encryption enhancement vector, and restore them to binary to obtain the odd-part encryption hybrid enhancement matrix; Add the even-part encryption confusion vector to the even-part encryption enhancement vector and restore it to binary to obtain the even-part encryption hybrid enhancement matrix; The formula for calculating the correlation value is: , in, This is the nth correlation value in the correlation vector. The nth value in the odd-part encryption enhancement vector. The mean value of the odd-part encryption enhancement vector. For the nth value in the even-part encryption enhancement vector, Let n be the mean value of the even-part encryption enhancement vector, where n is a positive integer; The formula for generating the odd-part encryption confusion vector is: , in, For the nth obfuscation value in the odd-part encryption obfuscation vector, This is the modulo operation; The formula for generating the even-part encryption confusion vector is: , in, For the even part of the encryption and confusion vector, the first One obfuscation value; Arrange the elements of each row of the odd-part encryption hybrid enhancement matrix in sequence to obtain the odd-part encryption bit sequence. Arrange the elements of each row of the even-part encryption hybrid enhancement matrix in sequence to obtain the even-part encryption bit sequence. Cross-arrange the odd-part encryption bit sequence and the even-part encryption bit sequence, that is, restore it according to the odd and even bits to obtain the ciphertext.
2. The data encryption method according to claim 1, characterized in that, The process of constructing odd-bit and even-bit matrices includes: The text data is converted into binary code to obtain a text binary sequence. Odd and even bits are selected from the text binary sequence to obtain odd bit sequences and even bit sequences. Both odd-bit and even-bit sequences are divided into 64-bit subsequences, resulting in multiple odd-bit subsequences and multiple even-bit subsequences. Each odd-bit subsequence is divided into equal-length 8-bit segments to obtain multiple 8-bit odd-bit segments; each 8-bit odd-bit segment is used as a row vector of a matrix to form an 8×8 odd-bit matrix. Each even-bit subsequence is divided into equal-length 8-bit segments to obtain multiple 8-bit even-bit segments; each 8-bit even-bit segment is used as a row vector of a matrix to form an 8×8 even-bit matrix.
3. The data encryption method according to claim 1, characterized in that, The process of generating a numerical vector includes: Convert each row of the odd shift matrix to decimal to obtain the row value, and then construct the odd row value vector from the row values. Convert each column of the odd shift matrix to decimal to obtain the column value, and construct an odd column value vector from the column values. Convert each row of the even shift matrix to decimal to obtain the row value, and then construct an even row numerical vector from the row values. Convert each column of the even shift matrix to decimal to obtain the column values, and then construct an even column numerical vector from the column values.
Citation Information
Patent Citations
Smart park data secure transmission method based on encryption algorithm
CN121567373A
Apparatus and method for implementing instruction support for the advanced encryption standard (AES) algorithm
US20100250965A1