Block cipher algorithm circle structure encryption method and system based on mixed bit width
By adopting a mixed bit width S box and MDS matrix design in the packet cipher algorithm circle structure, the problem of insufficient security caused by fixed bit width is solved, and stronger attack resistance and flexible security adaptability are achieved.
Patent Information
- Application Number
- CN202510658746.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-05-21
- Publication Date
- 2025-08-08
Smart Images

Figure CN120454977A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to a block cipher algorithm circle structure encryption method and system based on mixed bit width, belonging to the technical field of block cipher coding. Background Art
[0002] Block cipher is an important branch of symmetric cryptography and plays an extremely important role in network communication and information security.
[0003] The design of block ciphers originates from the "obfuscation" and "diffusion" theories proposed by Shannon in 1949. These theories are not only key principles in block cipher design but also provide a crucial guarantee for their security. In the late 1970s, the US National Bureau of Standards published the renowned Data Encryption Standard (DES) algorithm, marking the beginning of public research into block cipher design. By the late 1990s, the US AES program and the European NISSIE program had produced numerous outstanding block ciphers, leading to a growing interest in block cipher design. In 2006, my country published the SMS4 national block cipher standard, its first commercial cipher. Chinese researchers achieved significant breakthroughs in its construction and design, constructing a class of Boolean functions with high nonlinearity, optimal algebraic immunity, and optimal algebraic degree. The algorithm saw significant advancement and application from 2007 to 2009, significantly boosting the research and development of block cipher design.
[0004] Currently, research on block cipher algorithm design focuses on two aspects: the overall algorithm structure and the loop structure. In terms of overall algorithm structure design, the mainstream approaches include the Feistel, SPN, and LM structures, with representative block cipher algorithms including the SM4, AES, and FOX algorithms. Regarding loop structure design, since the security of the loop structure directly determines the security of the algorithm, its design is both a key and challenging aspect of block cipher algorithm design. The loop structure function provides the obfuscation and diffusion properties of the block cipher algorithm. Regarding the obfuscation properties, researchers have focused on designing nonlinear permutations with excellent differential uniformity and linear correlation, particularly 8-input, 8-output S-boxes generated by inversion operations over finite fields, such as AES. Regarding the diffusion properties, researchers have focused on designing linear transformations with excellent diffusion effects, particularly linear diffusion transformations such as MDS matrices over finite fields or matrix rings. However, the current circle structure design of block ciphers all adopts a fixed bit width design method. Once the bit width of the nonlinear permutation and linear transformation is fixed, it will no longer change. There is no circle structure design method that uses linear permutations or linear transformations with different bit widths, or a circle structure design method that is a mixture of the two. Summary of the Invention
[0005] The technical problem solved by the present invention is: to overcome the shortcomings of linear permutation or linear transformation of different bit widths, and to provide a block cipher algorithm ring structure encryption method and system based on mixed bit widths, which combines the characteristics of nonlinear processing functions and linear processing functions of different bit widths to generate a block cipher algorithm ring structure model with mixed bit width, which can adapt to the security requirements of different scenarios and significantly enhance the ability to resist differential / linear attacks.
[0006] The technical solution of the present invention is: in the first aspect, a ring structure encryption method based on a mixed bit width block cipher algorithm is provided, comprising:
[0007] The r-dimensional vector IN1 on the finite field GF2 is used as the input data of the ring structure, and the input data is preprocessed to obtain preprocessed data;
[0008] The subsequent N S-boxes and M MDS matrices are set at intervals, where N and M are two adjacent or equal integers; each S-box is denoted as Sh, and its bit width is sh; each MDS matrix is denoted as A g , the corresponding data block length is tg; 1≤h≤N, 1≤g≤M; when h=1 and g=1:
[0009] The preprocessed data is split into r / s1 s1-bit data blocks, and the first S-box S1 with a bit width of s1 is used to perform nonlinear permutation on each s1-bit data block to obtain the data block structure after nonlinear permutation;
[0010] The data block structure output by the first S-box S1 is merged and then split again into r / t1 t1-bit data blocks. The first MDS matrix A1 is used to perform a linear transformation on each t1-bit data block to obtain the data block structure after the linear transformation.
[0011] When h≥2, g≥2, and so on:
[0012] Merge the data blocks output by the previous MDS matrix and split them back into r / sh sh-bit data blocks. Use the h-th S-box Sh with a bit width of sh to perform nonlinear permutation on each sh-bit data block and output the data block structure after nonlinear permutation.
[0013] The data block structure after nonlinear permutation of the previous S-box output is merged and re-split into r / tg tg-bit data blocks, using the g-th MDS matrix A g Perform linear transformation on each tg-bit data block after reorganization, and output the data block structure after linear transformation;
[0014] Merge the data block structure output by the last S-box or MDS matrix into an r-dimensional data stream as the cipher output to complete the mixed bit-width block encryption;
[0015] The bit width sh of each S-box and the data block length tg corresponding to the MDS matrix can be set to different values.
[0016] Preferably, the input data is preprocessed, specifically:
[0017] Input the r-dimensional vector IN2 over the finite field GF2 of equal length as the circle key of the block cipher algorithm, perform bitwise XOR operation on IN1 and IN2, and obtain and output the r-bit data block X:
[0018]
[0019] The value of r is an integer multiple of 2.
[0020] Preferably, the bit width of each S-box is 4, 8, 16 or other integer multiples of 2 that are smaller than r.
[0021] Preferably, the data block length tg corresponding to the MDS matrix is 4, 8, 16 or other integer multiples of 2 that are smaller than r.
[0022] Preferably, the input and output of the nonlinear permutation are elements of the finite field GF(2);
[0023] The S-box Sh is composed of sh finite field Boolean functions juxtaposed, 0≤j≤sh-1, that is, δ h =(f h 0 , f h 1 ,……f h sh-1 ), record the input as: (a0, a1, ....., a sh-1 ), the output is recorded as: (b0, b1, ...b j .., b sh-1 ), the nonlinear permutation can be expressed as:
[0024]
[0025] Preferably, the input and output of the linear transformation are elements of the finite field GF(2);
[0026] MDS matrix A g is a finite field GF(2 tg ) on a (r / tg)×(r / tg)-order matrix:
[0027]
[0028] 0≤k≤r / tg-1; let the input be: (m0, m1, ..., mk ,...,m r / tg-1 ), the output is recorded as: (n0, n1, ..., n k ,...,n r / tg-1 ), the linear transformation can be expressed as:
[0029]
[0030] The operation ⊙ in this transformation is a finite field GF(2 tg ), the operation ⊕ is a finite field GF(2 tg ) is an addition operation on .
[0031] In the second aspect, a block cipher algorithm circle structure encryption system based on mixed bit width is provided, including: a preprocessing module, an algorithm circle module and an output module; specifically:
[0032] The preprocessing module takes the r-dimensional vector IN1 on the finite field GF2 as the input data of the circle structure, preprocesses the input data, obtains the preprocessed data, and outputs it to the algorithm circle module;
[0033] The algorithm circle module includes N confusion units and M diffusion units set at intervals, where N and M are two adjacent or equal integers. Each confusion unit uses an S box and each diffusion unit uses an MDS matrix; each S box is denoted as Sh, and its bit width is sh; each MDS matrix is denoted as A g , the corresponding data block length is tg; 1≤h≤N, 1≤g≤M; when h=1 and g=1: split the preprocessed data into r / s1 s1-bit data blocks, use the first S-box S1 with a bit width of s1 to perform nonlinear permutation on each s1-bit data block, and obtain the data block structure after nonlinear permutation; merge the data block structure output by the first S-box S1 and then split it again into r / t1 t1-bit data blocks, use the first MDS matrix A1 to perform linear transformation on each t1-bit data block, and obtain the data block structure after linear transformation; when h≥2, g≥2, and so on: merge the data blocks output by the previous MDS matrix and then split it again into r / sh sh-bit data blocks, use the h-th S-box Sh with a bit width of sh to perform nonlinear permutation on each sh-bit data block, and output the data block structure after nonlinear permutation; merge the data block structure after nonlinear permutation output by the previous S-box and then split it again into r / tg tg-bit data blocks, use the g-th MDS matrix A g Perform linear transformation on each tg-bit data block after reorganization, and output the data block structure after linear transformation;
[0034] The output module receives the data block structure output by the algorithm circle module and merges it into an r-dimensional data stream as the cipher output to complete the mixed bit width block encryption;
[0035] The bit width sh of each S-box and the data block length tg corresponding to the MDS matrix can be set to different values.
[0036] Preferably, when the preprocessing module preprocesses the input data:
[0037] Input the r-dimensional vector IN2 over the finite field GF2 of equal length to the preprocessing module as the circle key of the block cipher algorithm, perform bitwise XOR operation on IN1 and IN2, and obtain and output the r-bit data block X:
[0038]
[0039] The value of r is an integer multiple of 2.
[0040] Preferably, when the confusion unit performs nonlinear permutation, both the input and the output belong to elements on the finite field GF(2);
[0041] The S-box Sh is composed of sh finite field Boolean functions juxtaposed, 0≤j≤sh-1, that is, δ h =(f h 0 , f h 1 ,……f h sh-1 ), record the input as: (a0, a1, ....., a sh-1 ), the output is recorded as: (b0, b1, ...b j .., b sh-1 ), the nonlinear permutation can be expressed as:
[0042]
[0043] Preferably, the input and output of the diffusion unit when performing linear transformation are both elements on the finite field GF(2);
[0044] MDS matrix A g is a finite field GF(2 tg ) on a (r / tg)×(r / tg)-order matrix:
[0045]
[0046] 0≤k≤r / tg-1; let the input be: (m0, m1, ..., m k ,...,m r / tg-1 ), the output is recorded as: (n0, n1, ..., n k ,...,n r / tg-1 ), the linear transformation can be expressed as:
[0047]
[0048] The operation ⊙ in this transformation is a finite field GF(2 tg ), the operation ⊕ is a finite field GF(2 tg ) is an addition operation on .
[0049] Compared with the prior art, the present invention has the following advantages:
[0050] (1) This invention integrates nonlinear functions of different bit widths (such as 4-bit and 8-bit S-boxes) with linear functions (such as 32-bit and 64-bit MDS matrices) for the first time, breaking the traditional fixed bit width limitation and significantly enhancing the ability to resist differential / linear attacks through complex data traces and layered obfuscation mechanisms;
[0051] (2) The present invention proposes a dynamically configurable algorithm circle structure that supports flexible bit width combinations of nonlinear layers (s1 / s2 / s3) and linear layers (t1 / t2) (such as 8-bit wide S-box + 4-bit wide linear layer MDS matrix), adapting to the security requirements of different scenarios, and being compatible with multiple packet lengths (32 / 64 / 128 / 256 bits) with strong scalability. BRIEF DESCRIPTION OF THE DRAWINGS
[0052] Figure 1 The present invention is a flow chart of the block cipher algorithm ring structure based on mixed bit width;
[0053] Figure 2 is the nonlinear function δ of the present invention i Workflow diagram;
[0054] Figure 3 is the linear function θ of the present invention i Workflow diagram;
[0055] Figure 4 It is a schematic diagram of a specific embodiment of the present invention. DETAILED DESCRIPTION
[0056] The present invention discloses a block cipher algorithm ring structure encryption method based on mixed bit widths, providing a method for designing a block cipher algorithm ring structure using nonlinear processing functions and linear processing functions of different bit widths. The method is characterized by combining nonlinear processing functions and linear processing functions of different bit widths to generate a block cipher algorithm ring structure model with mixed bit widths.
[0057] 1. The method of the present invention consists of three parts. The first part is input data IN1 and input data IN2, and output data OUT; the second part is nonlinear processing function δ1, nonlinear processing function δ2 and nonlinear processing function δ3; the third part is linear processing function θ1 and linear processing function θ2; Figure 1As shown, the following steps are included:
[0058] 1. Step 1: Input data preprocessing:
[0059] The input data IN1 is an r-dimensional vector on the finite field GF2, and is input data of a ring structure. Usually, the value of r can be 32, 64, 96, 128, 256, etc.
[0060] The input data IN2 is an r-dimensional vector over the finite field GF2, has the same length as the input data IN1, and is usually a circle key of a block cipher algorithm.
[0061] Input: plaintext packet IN1∈GF(2 r ), subkey IN2∈GF(2 r );
[0062] Operation: Bitwise XOR operation on IN1 and IN2:
[0063] Output: r-bit data X.
[0064] 2. Step 2, nonlinear processing function δ1 (confusion layer 1):
[0065] The nonlinear processing function δ1 is a finite field GF(2 s1 )→GF(2 s1 ) is a nonlinear permutation that plays a confusing role in the loop structure. Usually, the value of s1 is 4, 8 or 16.
[0066] Input: data block X;
[0067] Operation: Split X into s1-bit data blocks and process them through S-boxes with a bit width of s1. That is, apply nonlinear permutation δ1 (S-box S1) to the split s1-bit data blocks respectively:
[0068] y i =δ1(x i ), i∈{0, 1, 2,..., r / s1-1}
[0069] where δ1:GF(2 s1 )→GF(2 s1 ), whose expression is:
[0070]
[0071] Output: processed data block Y=(y0,y1,K,y r / s1-1 ).
[0072] The workflow diagram of function δ1 is as follows Figure 2 shown.
[0073] 3. Step 3, linear transformation (diffusion layer 1):
[0074] The linear processing function θ1 is a finite field GF(2 t1 )→GF(2 t1 ) is the link that plays a diffusion role in the ring structure. Usually, the value of t1 is 4, 8, and 16.
[0075] Input: data block Y;
[0076] operate:
[0077] Step 3-1: Data reassembly: First, merge Y into an r-bit data stream (y0Py1P...Py r / s3 ), and then split into t1 bit blocks:
[0078] Z=(z0,z1,...,z r / t1-1 ), z k ∈GF(2 t1 );
[0079] Step 3-2: MDS matrix transformation: Apply linear permutation θ1 (MDS matrix A1) to achieve diffusion:
[0080]
[0081] Output: Diffusion data block W = (w0, w1, K, w r / t1-1 ).
[0082] The workflow diagram of function θ1 is as follows Figure 3 shown.
[0083] 4. Step 4, nonlinear processing δ2 (confusion layer 2):
[0084] The nonlinear processing function δ2 is a finite field GF(2 s2 )→GF(2 s2 ) is a nonlinear permutation that plays a confusing role in the loop structure. Usually, the value of s2 is 4, 8, and 16.
[0085] Input: Data block W = (w0, w1, K, w r / t1-1 );
[0086] operate:
[0087] Step 4-1: Data reorganization: Using the S-box s2 bit width according to the nonlinear processing function δ2, first merge W into an r-bit data stream, and then split it into r / s2 s2-bit blocks:
[0088] V=(v0,v1,...,v r / s2-1 ), v i∈GF(2 s2 ), i∈{0, 1, 2,..., r / s2-1};
[0089] Step 4-2: Pass S-box S2: For v i Apply nonlinear permutation δ2 (S-box S2) respectively:
[0090] m i =δ2(v i ),i∈{0,1,2,...,r / s2-1},
[0091] where δ2:GF(2 s2 )→GF(2 s2 ), whose expression is:
[0092]
[0093] Output: Diffusion data block M = (m0, m1, K, m r / s2-1 ).
[0094] 5. Step 5, linear transformation θ2 (diffusion layer 2):
[0095] The linear processing function θ2 is a finite field GF(2 t2 )→GF(2 t2 ) is a linear permutation of the ring structure, which plays a diffusion role. Usually, the value of t2 is 4, 8 and 16.
[0096] Input: data block M = (m0, m1, K, m r / s2-1 );
[0097] operate:
[0098] Step 5-1: Data reassembly: First, merge M into r-bit data streams, and then split them into t2-bit blocks:
[0099] N=(n0,n1,...,n r / t2-1 ), n i ∈GF(2 t2 ), i∈{0, 1, 2,..., r / t2-1};
[0100] Step 5-2: MDS matrix transformation: Apply linear permutation θ2 (MDS matrix A2) to achieve diffusion:
[0101]
[0102] Output: Diffusion data block L = (l0, l1, K, l r / t2-1 ).
[0103] 6. Step 6, nonlinear processing δ3 (confusion layer 3):
[0104] The nonlinear processing function δ3 is a finite field GF(2 s3 )→GF(2 s3 ) is a nonlinear permutation that plays a confusing role in the ring structure. Usually, the value of s3 is 4, 8, and 16.
[0105] Input: Data block L = (l0, l1, K, l r / t2-1 );
[0106] operate:
[0107] Step 6-1: Data Reorganization: The nonlinear processing function δ3 uses an S-box with a bit width of s3. First, W is merged into an r-bit data stream, and then split into r / s3 s3-bit blocks:
[0108] P=(p0, p1, ..., p r / s3-1 ), p i ∈GF(2 s3 ), i∈{0, 1, 2,..., r / s3-1};
[0109] Step 6-2: Pass S-box S3: For p i Apply nonlinear permutation δ2 (S-box S3) respectively:
[0110] q i =δ3(p i ),i∈{0,1,2,...,r / s3-1},
[0111] where δ3:GF(2 s3 )→GF(2 s3 ), whose expression is:
[0112]
[0113] Output: Diffused data block Q = (q0,q1,K,q r / s3-1 ).
[0114] 7. Step 7: Output generation:
[0115] The output data OUT is an r-dimensional vector on the finite field GF2, has the same length as the input data IN1, and is output data of a loop structure.
[0116] Input: Data block Q = (q0,q1,K,q r / s3-1 );
[0117] Operation: Merge Q into r-bit output OUT: OUT = q0 Pq1 P...Pq r / s3 ;
[0118] Output: data packet OUT∈GF(2 r ).
[0119] The nonlinear processing function δ in the model is i The input of (1≤i≤3) is (a0, a1, ....., a si-1 ), the output is (b0, b1, ....., b si-1 ), a k 、b k (0≤k≤si-1) are all elements of the finite field GF(2), where the nonlinear processing function δ i Equivalent to the previous S-box (S1, S2, S3).
[0120] The S-box Si is composed of si (1≤i≤3) finite fields GF (2 si )→GF(2) juxtaposition, i.e. δ i =(f i 0 , f i 1 ,……f i si-1 ), and its functional relationship is:
[0121]
[0122] The linear processing function θ of the model is i The input of (1≤i≤2) is (m0, m1, ..., m k ,...,m r / ti-1 ), the output is (n0, n1, ..., n k ,...,n r / ti-1 ), m k 、n k (0≤k≤r / ti-1, 1≤i≤3) all belong to the finite field GF(2 r / ti ) on the element.
[0123] Linear processing function θ i When performing linear transformation, the finite field GF(2 ti ) on the (r / ti) × (r / ti) order MDS matrix, denoted as A i , which can be expressed as:
[0124]
[0125] The functional relationship is:
[0126]
[0127] The operation ⊙ in this transformation is a finite field GF(2ti ), the operation ⊕ is a finite field GF(2 ti ) is an addition operation on .
[0128] 2. A ring structure encryption system based on a mixed bit-width block cipher algorithm
[0129] In the second aspect, a block cipher algorithm circle structure encryption system based on mixed bit width is provided, including: a preprocessing module, an algorithm circle module and an output module; specifically:
[0130] The preprocessing module takes the r-dimensional vector IN1 on the finite field GF2 as the input data of the circle structure, preprocesses the input data, obtains the preprocessed data, and outputs it to the algorithm circle module;
[0131] The algorithm circle module includes N confusion units S-boxes and M diffusion units set at intervals. Each confusion unit uses an S-box and each diffusion unit uses an MDS matrix: the preprocessed data is split into r / s1 s1-bit data blocks, and the first S-box S1 with a bit width of s1 is used to perform nonlinear permutation on each s1-bit data block to obtain the data block structure after nonlinear permutation; the data block structure output by the first S-box S1 is merged and then split again into r / t1 t1-bit data blocks, and the first MDS matrix A1 is used to perform linear transformation on each t1-bit data block to obtain The data block structure after linear transformation; and so on, the subsequent N-1 S-boxes and M-1 MDS matrices are set at intervals, where N and M are two adjacent integers: the data blocks output by the previous MDS matrix are merged and re-split into r / sh sh-bit data blocks, and each sh-bit data block is nonlinearly permuted using the h-th S-box Sh with a bit width of sh, and the data block structure after nonlinear permutation is output; 1≤h≤N; the data block structure after nonlinear permutation output by the h-th S-box is merged and re-split into r / tg tg-bit data blocks, and the g-th MDS matrix A is used. g Perform a linear transformation on each tg-bit data block after reorganization and output the data block structure after the linear transformation; 1≤g≤M; send the data block structure output by the last S-box or MDS matrix to the output module;
[0132] The output module receives the data block structure output by the algorithm circle module and merges it into an r-dimensional data stream as the cipher output to complete the mixed bit width block encryption;
[0133] The bit width sh of each S-box and the data block length tg corresponding to the MDS matrix can be set to different values.
[0134] 3. Example
[0135] In order to better understand the technical solution of the present invention, the specific implementation methods of the present invention are described below.
[0136] In this example, refer to Figure 4 The specific implementation process is as follows:
[0137] First, the specific parameter values are given: the input and output of the circle structure and the circle key length are all 64 bits, the nonlinear processing function δ1 is an 8-input 8-output S-box S1, the nonlinear processing function δ2 is a 4-input 4-output S-box S2, the nonlinear processing function δ3 is an 8-input 8-output S-box S3, and the linear processing function θ1 is a finite field GF(2 8 ) on the 8×8 order MDS matrix A1, the linear processing function θ2 is the finite field GF(2 8 ) on an 8×8-order MDS matrix A2, i.e., r=64, s1=8, s2=4, s3=8, t1=8, t2=8;
[0138] 1. Step 1: Input data preprocessing:
[0139] Input: plaintext packet IN1∈GF(2) 64 , subkey IN2∈GF(2) 64 ;
[0140] operate:
[0141] Step 1-1: Perform bitwise XOR operation on IN1 and IN2: X = IN1 ⊕ IN2;
[0142] Step 1-2: Split X into 8-bit data blocks according to s1=8:
[0143] X=(x0,x1,K,x7),
[0144] where x i ∈GF(2 8 ), i∈{0,1,2,...,7}.
[0145] Output: Data block X = (x0, x1, K, x7) with a bit width of 8.
[0146] 2. Step 2, nonlinear processing δ1 (confusion layer 1):
[0147] Input: data block X = (x0,x1,x2,x3,x4,x5,x6,x7);
[0148] Operation: Process through 8-bit S-box, for x i Apply the nonlinear permutation δ1 (S1 box) respectively:
[0149] y i =δ1(x i ), i∈{0,1,2,...,7},
[0150] where δ1:GF(2 8 )→GF(2 8 ), whose expression is:
[0151]
[0152] Output: processed data block Y = (y0, y1, K, y7).
[0153] 3. Step 3, linear transformation θ1 (diffusion layer 1):
[0154] Input: data block Y = (y0, y1, K, y7);
[0155] operate:
[0156] Step 3-1: Data reorganization: According to the linear processing function θ1 is a finite field GF(2 8 ), first merge Y into a 64-bit data stream and then split it into 8-bit blocks:
[0157] Z=(z0,z1,...,z7),z k ∈GF(2 8 );
[0158] Step 3-2: MDS matrix transformation: Apply linear permutation θ1 (MDS matrix A1) to achieve diffusion:
[0159]
[0160] Where A1 is an 8×8 MDS matrix that satisfies:
[0161] A1∈GF(2 8 ) 8×8 ,Number of branches = 9;
[0162] Output: Diffused data block W = (w0, w1, K, w7).
[0163] 4. Step 4, nonlinear processing δ2 (confusion layer 2):
[0164] Input: data block W = (w0, w1, K, w7);
[0165] operate:
[0166] Step 4-1: Data reorganization: According to the nonlinear processing function δ2, which is a 4-input 4-output S-box S2, first merge W into a 64-bit data stream and then split it into 16 4-bit blocks:
[0167] V=(v0,v1,...,v 15 ), v i ∈GF(2 4), i∈{0, 1, 2, ..., 15};
[0168] Step 4-2: Pass S-box S2: For v i Apply nonlinear permutation δ2 (S-box S2) respectively:
[0169] m i =δ2(v i ), i∈{0, 1, 2, ..., 15},
[0170] where δ2:GF(2 4 )→GF(2 4 ), whose expression is:
[0171]
[0172] Output: Diffusion data block M = (m0, m1, K, m 15 ).
[0173] 5. Step 5, linear transformation θ2 (diffusion layer 2):
[0174] Input: data block M = (m0, m1, K, m 15 );
[0175] operate:
[0176] Step 5-1: Data reorganization: According to the linear processing function θ2 is a finite field GF(2 8 ), first merge M into a 64-bit data stream and then split it into 8-bit blocks:
[0177] N=(n0,n1,...,n7),n k ∈GF(2 8 );
[0178] Step 5-2: MDS matrix transformation: Apply linear permutation θ2 (MDS matrix A2) to achieve diffusion:
[0179]
[0180] Where A2 is the same 8×8 MDS matrix as A1.
[0181] Output: Diffused data block L = (l0, l1, K, l7).
[0182] 6. Step 6, nonlinear processing δ3 (confusion layer 3):
[0183] Input: data block L = (l0, l1, K, l7);
[0184] operate:
[0185] Through 8-bit S-box processing, l i Apply nonlinear permutation δ3 (S-box S3) respectively:
[0186] r i =δ3(l i ), i∈{0, 1, 2, ..., 7},
[0187] where δ3:GF(2 8 )→GF(2 8 ), whose expression is:
[0188]
[0189] Output: Diffused data block R = (r0, r1, K, r7).
[0190] 7. Step 7: Output generation:
[0191] Input: data block L = (l0, l1, K, l7);
[0192] Operation: Merge L into 64-bit output OUT: OUT = l0 Pl1 P...Pl7.
[0193] Output: data packet OUT∈GF(2 64 ).
[0194] 8. Supplementary explanation of the formula:
[0195] 1. MDS matrix operation:
[0196] The matrix multiplication of the linear transformation θ1 is defined as:
[0197]
[0198] 2. Mixed bit width design:
[0199] By combining S-boxes of different bit widths (8-bit and 4-bit) and linear transformations (finite field GF(2 8 ) to achieve the mixed use of components with good cryptographic properties of different bit widths, and significantly enhance the anti-attack capability of the cryptographic algorithm through complex data traces and layered obfuscation mechanisms.
[0200] In particular, when S3 is the inverse of S1, S2 is an involutive transformation, and A2 is the inverse of A1, the ring structure of this implementation scheme not only has the characteristics of widening the trajectory in the nonlinear processing link, but also has encryption and decryption consistency. At the same time, due to the characteristics of the MDS matrix, it can be seen that the ring structure has the cryptographic property of achieving full diffusion in one round.
[0201] The contents not described in detail in the specification of the present invention belong to the prior art known to those skilled in the art.
Claims
1. A ring structure encryption method based on a mixed bit width block cipher algorithm, characterized in that include: The r-dimensional vector IN1 on the finite field GF2 is used as the input data of the ring structure, and the input data is preprocessed to obtain preprocessed data; The subsequent N S-boxes and M MDS matrices are set at intervals, where N and M are two adjacent or equal integers; each S-box is denoted as Sh, and its bit width is sh; each MDS matrix is denoted as A g , the corresponding data block length is tg; 1≤h≤N, 1≤g≤M; when h=1 and g=1: The preprocessed data is split into r / s1 s1-bit data blocks, and the first S-box S1 with a bit width of s1 is used to perform nonlinear permutation on each s1-bit data block to obtain the data block structure after nonlinear permutation; The data block structure output by the first S-box S1 is merged and then split again into r / t1 t1-bit data blocks. The first MDS matrix A1 is used to perform a linear transformation on each t1-bit data block to obtain the data block structure after the linear transformation. When h≥2, g≥2, and so on: Merge the data blocks output by the previous MDS matrix and split them back into r / sh sh-bit data blocks. Use the h-th S-box Sh with a bit width of sh to perform nonlinear permutation on each sh-bit data block and output the data block structure after nonlinear permutation. The data block structure after nonlinear permutation of the previous S-box output is merged and re-split into r / tg tg-bit data blocks, using the g-th MDS matrix A g Perform linear transformation on each tg-bit data block after reorganization, and output the data block structure after linear transformation; Merge the data block structure output by the last S-box or MDS matrix into an r-dimensional data stream as the cipher output to complete the mixed bit-width block encryption; The bit width sh of each S-box and the data block length tg corresponding to the MDS matrix can be set to different values.
2. The ring structure encryption method based on a mixed bit-width block cipher algorithm according to claim 1, characterized in that: Preprocess the input data, specifically: Input the r-dimensional vector IN2 over the finite field GF2 of equal length as the circle key of the block cipher algorithm, perform bitwise XOR operation on IN1 and IN2, and obtain and output the r-bit data block X: The value of r is an integer multiple of 2.
3. The ring structure encryption method based on a mixed bit-width block cipher algorithm according to claim 1, characterized in that: The bit width of each S-box is 4, 8, 16 or other integer multiples of 2 that are less than r.
4. The ring structure encryption method based on a mixed bit-width block cipher algorithm according to claim 3, characterized in that: The data block length tg corresponding to the MDS matrix is 4, 8, 16 or other integer multiples of 2 that are less than r.
5. The ring structure encryption method based on a mixed bit-width block cipher algorithm according to claim 1, characterized in that: The input and output of the nonlinear permutation are both elements of the finite field GF(2); The S-box Sh is composed of sh finite field Boolean functions juxtaposed, 0≤j≤sh-1, that is, δ h =(f h 0 , f h 1 ,……f h sh -1 ), record the input as: (a0, a1, ....., a sh-1 ), the output is recorded as: (b0, b1, ...b j .., b sh-1 ), the nonlinear permutation can be expressed as:
6. The ring structure encryption method based on a mixed bit-width block cipher algorithm according to claim 1, characterized in that: The input and output of the linear transformation are both elements of the finite field GF(2); MDS matrix A g is a finite field GF(2 tg ) on a (r / tg)×(r / tg)-order matrix: 0≤k≤r / tg-1; let the input be: (m0, m1, ..., m k ,...,m r / tg-1 ), the output is recorded as: (n0, n1, ..., n k ,...,n r / tg-1 ), the linear transformation can be expressed as: The operation ⊙ in this transformation is a finite field GF(2 tg ) on the multiplication operation, operation is a finite field GF(2 tg ) is an addition operation on .
7. A ring structure encryption system based on a mixed bit width block cipher algorithm, characterized in that include: Preprocessing module, algorithm module and output module; specifically: The preprocessing module takes the r-dimensional vector IN1 on the finite field GF2 as the input data of the circle structure, preprocesses the input data, obtains the preprocessed data, and outputs it to the algorithm circle module; The algorithm circle module includes N confusion units and M diffusion units set at intervals, where N and M are two adjacent or equal integers. Each confusion unit uses an S box and each diffusion unit uses an MDS matrix; each S box is denoted as Sh, and its bit width is sh; each MDS matrix is denoted as A g , the corresponding data block length is tg; 1≤h≤N, 1≤g≤M; when h=1 and g=1: split the preprocessed data into r / s1 s1-bit data blocks, use the first S-box S1 with a bit width of s1 to perform nonlinear permutation on each s1-bit data block, and obtain the data block structure after nonlinear permutation; merge the data block structure output by the first S-box S1 and then split it again into r / t1 t1-bit data blocks, use the first MDS matrix A1 to perform linear transformation on each t1-bit data block, and obtain the data block structure after linear transformation; when h≥2, g≥2, and so on: merge the data blocks output by the previous MDS matrix and then split it again into r / sh sh-bit data blocks, use the h-th S-box Sh with a bit width of sh to perform nonlinear permutation on each sh-bit data block, and output the data block structure after nonlinear permutation; merge the data block structure after nonlinear permutation output by the previous S-box and then split it again into r / tg tg-bit data blocks, use the g-th MDS matrix A g Perform linear transformation on each tg-bit data block after reorganization, and output the data block structure after linear transformation; The output module receives the data block structure output by the algorithm circle module and merges it into an r-dimensional data stream as the cipher output to complete the mixed bit width block encryption; The bit width sh of each S-box and the data block length tg corresponding to the MDS matrix can be set to different values.
8. The ring structure encryption system based on a mixed bit-width block cipher algorithm according to claim 7, characterized in that: When the preprocessing module preprocesses the input data: Input the r-dimensional vector IN2 over the finite field GF2 of equal length to the preprocessing module as the circle key of the block cipher algorithm, perform bitwise XOR operation on IN1 and IN2, and obtain and output the r-bit data block X: The value of r is an integer multiple of 2.
9. The ring structure encryption system based on a mixed bit-width block cipher algorithm according to claim 7, characterized in that: When the confusion unit performs nonlinear permutation, both the input and output belong to elements on the finite field GF(2); The S-box Sh is composed of sh finite field Boolean functions juxtaposed, 0≤j≤sh-1, that is, δ h =(f h 0 , f h 1 ,……f h sh -1 ), record the input as: (a0, a1, ....., a sh-1 ), the output is recorded as: (b0, b1, ...b j .., b sh-1 ), the nonlinear permutation can be expressed as:
10. The ring structure encryption system based on a mixed bit-width block cipher algorithm according to claim 7, characterized in that: The input and output of the diffusion unit when performing linear transformation belong to elements on the finite field GF(2); MDS matrix A g is a finite field GF(2 tg ) on a (r / tg)×(r / tg)-order matrix: 0≤k≤r / tg-1; let the input be: (m0, m1, ..., m k ,...,m r / tg-1 ), the output is recorded as: (n0, n1, ..., n k ,...,n r / tg-1 ), the linear transformation can be expressed as: The operation ⊙ in this transformation is a finite field GF(2 tg ) on the multiplication operation, operation is a finite field GF(2 tg ) is an addition operation on .