Encryption and decryption method based on lightweight block cipher tenon algorithm

By adopting a lightweight packet cipher tenon algorithm and SPN structure in the packet cipher algorithm, combining the 8-bit nonlinear layer S box and key arrangement algorithm, the problem of large resource consumption and difficulty in taking into account in the existing technology is solved, and an efficient, secure and lightweight Tenon packet cipher algorithm is realized.

CN114531223BActive Publication Date: 2025-04-01SHANGHAI JIAOTONG UNIV
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202210002951.7
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-01-04
Publication Date
2025-04-01
Estimated Expiration
2042-01-04

AI Technical Summary

Technical Problem

Existing packet cipher algorithms require a large amount of software and hardware resources when implementing security, making it difficult to apply to micro IoT devices, and at the same time, the overly simple logical structure is difficult to meet security requirements.

Method used

An encryption method based on lightweight packet cipher tenon algorithm is designed, using SPN structure and 8-bit nonlinear layer S box, combined with key orchestration algorithm and bit-level wire pull-over substitution, to realize an efficient, secure and lightweight Tenon packet cipher algorithm.

Benefits of technology

It significantly reduces the cost of hardware implementation, achieves the cryptographic properties of differential uniformity 8 and nonlinearity 96, and is suitable for resource-constrained devices, while achieving a better balance in security and implementation performance.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN114531223B_ABST
    Figure CN114531223B_ABST
Patent Text Reader

Abstract

An encryption and decryption method based on a lightweight block cipher Tenon algorithm is provided, wherein the data to be encrypted is divided into plaintext blocks P of equal length according to the block length of each group of n bits, a master key K is set, and the length is m1 bits. The master key K generates a round key #imgabs0#1≤r≤30 of the Tenon block cipher algorithm through a key arrangement algorithm, and the length is m2 bits, m1=128, m2=64. During the encryption process, the input data to be encrypted is subjected to R rounds of iterative encryption operations, and an n-bit ciphertext block C is output. The present invention comprehensively considers security and implementation cost, and is based on the SPN structure design, and can realize an efficient, secure, and lightweight Tenon block cipher algorithm, and is suitable for application on resource-constrained devices.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to a technology in the field of information security, in particular to an implementation method of a lightweight block cipher Tenon algorithm. Background Art

[0002] Existing block cipher algorithms require relatively complex operations and structures to achieve the best security under known circumstances, but this requires a large amount of software and hardware resources, making the algorithm implementation slower and difficult to apply to micro IoT devices. If an overly simple logical structure is used, it will be difficult to meet the security requirements. Summary of the invention

[0003] In view of the above-mentioned deficiencies in the prior art, the present invention proposes an encryption and decryption method based on a lightweight block cipher Tenon algorithm, which comprehensively considers security and implementation cost, and is based on the SPN structure design, and can implement an efficient, secure and lightweight Tenon block cipher algorithm, which is suitable for application on resource-constrained devices.

[0004] The present invention is achieved through the following technical solutions:

[0005] The present invention relates to an encryption method based on a lightweight block cipher tenon-type algorithm, comprising:

[0006] Step 1) Divide the data to be encrypted into plaintext groups P of equal length according to the group length, each group of n bits, where n=64;

[0007] Step 2) Set the master key K, which is m1 bits long, and generate the round keys of the Tenon block cipher algorithm from the master key K through the key scheduling algorithm The length is m2 bits, m1 = 128, m2 = 64, specifically: for the rth round key, the first The bits are assigned to the 64-bit round key in sequence. For example, for the first round, the 1st, 2nd, 4th, 7th, ..., 97th bits of the master key are assigned to the 0th, 1st, 2nd, ..., 63rd bits of the round key. Divide into 4 groups according to 16-bit length For the round number r, it is represented as a 5-bit binary number, with the rightmost bit being the low bit: for example, for the round number r = 11, it is represented as 01011. Then: 1. Perform AND operations on the 15th, 16th, 31st, 47th, and 63rd bits of the round key and the five bits of the binary representation of r in sequence, and the result is updated to the new k 15 ,k 16 ,k 31 ,k 47 ,k 63 2. The 16 bits of the bit are bitwise inverted to get the new k 32 k 33 …k 47 ; 3. k 48 k 49 …k 63 With k 32 k 33 …k 47 After the bitwise AND operation, it is then ANDed with k0k1…k 15 Perform bitwise XOR operation to get the new k 48 k 49 …k 63 . After the update is completed, the 64-bit k0k1…k 63 Divided into 4 groups according to 16-bit length That is the round key of the rth round, and the master key is updated to 128 bits

[0008] Step 3) During the encryption process, the input data to be encrypted is subjected to R rounds of iterative encryption operations, and the ciphertext is output, specifically:

[0009] 3.1) For R = 1, 2, 3, ..., 29 rounds, in each round of encryption: the n-bit plaintext group P is combined with the m2-bit round key K of the i-th round i After the round key is added, it is divided into eight 8-bit bytes, which are replaced by nonlinear layer S boxes and linear layer permutations in turn, and the output data is used as the input for the next round.

[0010] The positive integer n=64; m1=128; m2=64; R=30;

[0011] The round key addition is specifically implemented as follows: the 64-bit plaintext group P input in each round is represented from high to low as {P0, P1, P2, ..., P 62 ,P 63}, the 64-bit round key of round r From high to low, it is represented as {k0,k1,k2,k3,…,k 61 ,k 62 ,k 63}, bitwise change P i With k i (0≤i≤63) to obtain a new plaintext group P={P0,P1,P2,…,P 62 ,P 63};

[0012] The specific implementation of the nonlinear layer S-box replacement is: the plain text P after round key addition is 62 ,P 63}From high to low, every 8 bits are divided into a group, and 8 8-bit byte groups are obtained, recorded as W0, W1, W2, W3, W4, W5, W6, W7, where W i ={w 8i+0 ,w 8i+1 ,w 8i+2 ,w 8i+3 ,w 8i+4 ,w 8i+5 ,w 8i+6 ,w 8i+7}, 0≤i≤7, W0, W1, W2, W3, W4, W5, W6, W7 are simultaneously passed through 8 juxtaposed S-boxes. The specific process is to take eight identical 8-bit input and 8-bit output S-box transformations. The transformation is to transform W i As an 8-bit input, it is processed by S-box operation to obtain a new 8-bit output W' i ={w′ 8i+0 ,w′ 8i+1 ,…,w′ 8i+6 ,w′ 8i+7}=S(W i )=S({w 8i+0 ,w 8i+1 ,…,w 8i+6 ,w 8i+7}). The Tenon algorithm S-box is constructed based on an 8-level NFSR (nonlinear feedback shift register). One S-box operation requires 11 iterations. The output of the previous beat will be used as the input of the next beat. In each beat, the sixth bit of the input is used as the first bit of the output; the third bit of the input is inverted and then ANDed with the eighth bit, and then XORed with the fifth and sixth bits to obtain the second bit of the output; the second bit of the input is used as the third bit of the output; the eighth bit of the input is used as the fourth bit of the output; the sixth bit of the input is used as the seventh bit of the output; the fourth bit of the input is used as the sixth bit of the output; the third bit of the input is used as the seventh bit of the output; the sixth bit of the input is first ANDed with the eighth bit, and then XORed with the first and fifth bits to obtain the eighth bit of the output. After the above 11-beat operation, the outputs of the 8 juxtaposed S-boxes are W′0, W′1, W′2, W′3, W′4, W′5, W′6, W′7, which are combined from high to low into 64 bits C={C0, C1, C2, …, C 62 ,C 63};

[0013] The linear layer permutation is specifically: the 64 bits after the nonlinear layer S-box replacement operation are subjected to bit-level wire permutation. The specific process is that the 64 bits replace the output 8 bits to the new position in the order of 8 S-boxes: i The 8-bit output W′ obtained after an S-box substitutioni ={w′ 8i+0 ,w′ 8i+1 ,w′ 8i+2 ,w′ 8i+3 ,w′ 8i+4 ,w′ 8i+5 ,w′ 8i+6 ,w′ 8i+7} is transformed into

[0014] {C [8(i+1)]mod64+(2i+1)mod8 ,C [8(i+2)]mod64+(2i+2)mod8 ,C [8(i+3)]mod64+(2i+3)mod8 ,C [8(i+4)]mod64+(2i+4)mod8 ,C [8(i+5)]mod64+(2i+5)mod8 ,C [8(i+6)]mod64+(2i+6)mod8 ,C [8(i+7)]mod64+(2i+7)mod8 ,C [8(i+8)]mod64+(2i+8)mod8}, where 0≤i≤7.

[0015] 3.2) For R = 30 rounds, the n-bit group P is combined with the m2-bit round key K of the i-th round i After the round key is added, it is divided into 8 8-bit bytes, replaced by the nonlinear layer S box, and the final 64-bit ciphertext block C is directly output.

[0016] The present invention relates to a decryption method of the above encryption method, comprising: generating round keys by key scheduling algorithm, nonlinear layer inverse S-box substitution, round key addition and linear layer inverse substitution.

[0017] The key arrangement algorithm is the same as step 2) in the encryption process; the nonlinear layer inverse S box is replaced by dividing the 64-bit ciphertext group C into 8 groups according to the 8-bit width, and the i-th group is recorded as W′ i ={w′ 8i+0 ,w′ 8i+1 ,w′ 8i+2 ,w′ 8i+3 ,w′ 8i+4 ,w′ 8i+5 ,w′ 8i+6 ,w′ 8i+7},0≤i≤7, and W′ i After inverse S-box substitution, we get W i , where the selected inverse S-box is described in the specific implementation method; the round key addition operation is the same as the round key addition described in step 3.1; the inverse linear layer transform is to convert the ciphertext group C {C [8(i+1)]mod64+(2i+1)mod8 ,C [8(i+2)]mod64+(2i+2)mod8 ,C [8(i+3)]mod64+(2i+3)mod8 ,C [8(i+4)]mod64+(2i+4)mod8 ,C [8(i+5)]mod64+(2i+5)mod8 ,C [8(i+6)]mod64+(2i+6)mod8 ,C [8(i+7)]mod64+(2i+7)mod8 ,C [8(i+8)]mod64+(2i+8)mod8}Transform to W′ i ={w′ 8i+0 ,w′8i+1 ,w′ 8i+2 ,w′ 8i+3 ,w′ 8i+4 ,w′ 8i+5 ,w′ 8i+6 ,w′ 8i+7}, which is the opposite of the wire permutation chosen during encryption.

[0018] For R=30, only two operations need to be performed on the ciphertext group C: inverse S-box substitution and round key addition; for 1≤R≤29, the decryption process needs to perform three operations of linear layer inverse permutation, inverse S-box substitution and round key addition in sequence to finally obtain the correct plaintext group P.

[0019] Technical Effects

[0020] The 8-bit nonlinear layer S-box used in the present invention is based on a nonlinear feedback shift register design, which can significantly reduce the cost of hardware implementation; in terms of cryptographic properties, it reaches a differential uniformity of 8 and a nonlinearity of 96; compared with the transformation used in the PRESENT algorithm, the selected linear transformation can change the position of 64 bits after permutation, preventing potential weaknesses caused by fixed points; the key scheduling algorithm adopts a nonlinear scheduling method, which increases security. BRIEF DESCRIPTION OF THE DRAWINGS

[0021] Figure 1 A schematic diagram of a single-shot structure of a nonlinear feedback shift register used in the S-box of the present invention;

[0022] Figure 2 This is a schematic diagram of the linear layer wire replacement used in the present invention;

[0023] Figure 3 It is a flow chart of the present invention. DETAILED DESCRIPTION

[0024] like Figure 3 As shown, in this embodiment, the SPN structure is adopted, the packet length is 64 bits, the key length is 128 bits, the algorithm iteration round number is 30 rounds, P is a 64-bit plaintext packet, C is a 64-bit ciphertext packet, R is the algorithm iteration round number, r is the current round of the algorithm, 1≤r≤30, r i is the binary representation of the current round number, 1≤r≤30,0≤i≤4, K is the 128-bit master key, is the round key of the rth round, with a length of 64 bits, r = 1, 2, ..., 30, P i is the i-th bit of the plaintext packet from high to low, i = 0, 1, 2, ..., 62, 63, K i The i-th bit from high to low of the master key, i = 0, 1, 2, ..., 126, 127, k iis the i-th bit of the round key from high to low, i=0,1,2,…,62,63, is the 16-bit process word in the 64-bit round key used for key expansion, i = 0, 1, 2, 3, is the 16-bit word in the final output 64-bit round key, W i is the state word before entering the S-box replacement, each word is 8 bits long, i = 0, 1, ..., 6, 7, W' i is the state word after S-box replacement, each word is 8 bits long, i = 0, 1, ..., 6, 7, S is a 16-bit all-1 sequence, is a bit-level XOR operation, & is a bit-level AND operation, || is a string concatenation operator, and the Tenon algorithm of the present invention is designed based on the SPN structure. The implementation process is mainly divided into two parts: S-box substitution (non-linear layer) and wire permutation (linear layer).

[0025] like Figure 1 As shown, this embodiment relates to a method for implementing a lightweight block cipher algorithm, comprising the following steps:

[0026] Step 1: Group the data to be encrypted into 64-bit groups, encrypt each group separately, and record a group of data to be encrypted as P; set the master key, the master key length is 128 bits, and obtain the 64-bit round key according to the key expansion algorithm. The round key of the rth round is recorded as

[0027] Step 2: Set the master key K to m1 bits in length. The master key K is used to generate the round keys of the Tenon block cipher algorithm through the key scheduling algorithm. The length is m2 bits, m1 = 128, m2 = 64, where the key scheduling algorithm of the Tenon algorithm is as follows: For r = 1, 2, ..., 30, take the first Bit: A total of 64 bits, assigned in sequence

[0028] The current round number r is represented by a 5-bit binary number as r0, r1, r2, r3, r4. Calculate k 15 =k 15 &r0;k 16 =k 16 &r1;k 31 =k 31 &r2;k 47 =k 47 &r3;k 63 =k 63&r4;Will get Divided into 4 groups with a length of 16 bits, denoted as calculate: Output the current round key The master key is updated to Then proceed with the next round of key calculation.

[0029] Step 3) During the encryption process, the input data to be encrypted is subjected to R rounds of iterative encryption operations to output the ciphertext. For R = 1, 2, 3, ..., 29 rounds, in each round of encryption operation: the n-bit plaintext group P is combined with the m2-bit round key K of the i-th round. i After the round key is added, it is divided into 8 8-bit bytes, which are replaced by nonlinear layer S boxes and linear layer permutations in turn. The output data is used as the input for the next round. The specific process is as follows: The plaintext group and the round key are divided into P0, P1, ..., P according to the bit order. 62 ,P 63 and k0,k1,…,k 62 ,k 63 , for i=0,1,2,3,4,5,6,7, calculate

[0030] The nonlinear layer S-box replacement operation is specifically as follows: the new plaintext group obtained by adding the round key is divided into 8 state words, each state word is 8 bits long, that is, P = W0||W1||W2|W3||W4||W5||W6||W7; for W i , and transform it through an 8-bit-in 8-bit-out S-box to obtain a new 8-bit state word W i ′. Each transformation requires 11 iterations, and the process of each iteration includes; w′0=w5; w′2=w1; w′3=w7; w′4=w6; w′5=w3; w′6=w2; w′0w′1w′2w′3w′4w′5w′6w′7 is used as the new w0w1w2w3w4w5w6w7, and enters the next beat. ; You can also use each state word W i Expressed in decimal, by looking up the S-box truth table and then converting to binary, we get the new state word W' i , 0≤i≤7.

[0031] The decimal representation of the truth table of the S-box used is {0,191,119,88,130,86,165,114,57,77,91,139,148,132,200,84,34,120,180,209,203,42,234,249,61,236,223,192,18,195,21,95,121,219,122,11,221,123,31,60,163,7,112,246,46,55,56,194,210,102,116,143,47,45,173,224,63,141,190,201,17 ,25,157,133,205,87,28,147,152,30,64,158,129,248,125,182,176,188,154,100,159,230,105,153,103,5,8,89,73,92,107,247,241,238,174,26,229,81,2,104,43,49,227,137,68,212,211,66,251,127,242,76,189,94,111,109,235,36,70,169,14,78,183,22,170,23, 214,74,255,250,231,1,79,85,110,178,150,96,240,71,69,29,51,93,185,144,145,12,215,33,217,175,135,166,161,59,155,118,24,75,13,131,128,156,115,228,186,54,149,196,98,167,37,138,67,237,233,207,99,126,216,254,58,3,136,140,41,97,6,53,225,16 4,39,181,162,38,19,253,83,142,90,171,220,198,226,52,27,199,101,80,218,239,117,9,50,48,108,124,206,15,252,177,208,35,44,62,151,245,168,243,10,222,32,244,179,193,65,134,232,72,213,202,113,160,20,187,4,204,106,184,172,16,197,146,40,82}.

[0032] The 8 state words W0′||W1′||W2′||W3′||W4′||W5′||W6′||W7′ obtained through the nonlinear layer are arranged in bit order from high to low to obtain a 64-bit C={C0,C1,C2,…,C 62 ,C 63}.

[0033] The linear layer permutation operation described in step 5 is as follows:

[0034] The 64 bits after the nonlinear layer S-box replacement operation are subjected to bit-level wire replacement. The specific process is that the 64 bits replace the output 8 bits to the new position in the order of 8 S-boxes: W i The 8-bit output W′ obtained after an S-box substitution I ={C 8i+0 ,C 8i+1 ,C 8i+2 ,C 8i+3 ,C 8i+4 ,C 8i+5 ,C 8i+6 ,C 8i+7}Transform to get the next round of input plaintext grouping, which is {P [8(i+1)]mod64+(2i+1)mod8 ,P [8(i+2)]mod64+(2i+2)mod8 ,P [8(i+3)]mod64+(2i+3)mod8 ,P [8(i+4)]mod64+(2i+4)mod8 ,

[0035] P [8(i+5)]mod64+(2i+5)mod8 ,P [8(i+6)]mod64+(2i+6)mod8 ,P [8(i+7)]mod64+(2i+7)mod8 ,P [8(i+8)]mod64+(2i+8)mod8}, where 0≤i≤7.

[0036] Table 1 shows the correspondence of linear layer permutation.

[0037]

[0038]

[0039] For the 30th round, no linear layer permutation operation is performed, and the 8 state words after the S-box replacement operation are directly combined in sequence into the final ciphertext output, that is, let C = W0′||W1′||W2′||W3′||W4′||W5′||W6′||W7′.

[0040] The decryption process in step 4 and step 5 is as follows:

[0041] Expand the 128-bit master key K into a 64-bit wheel key according to the key scheduling algorithm For r=1,2,3,…,30, repeat the following operations.

[0042] The ciphertext is grouped into 64-bit fixed length groups, and each ciphertext group C is divided into 8 8-bit state words W0′||W1′||W2′||W3′||W4′||W5′||W6′||W7′ in sequence.

[0043] For each status word W′ i , after the inverse S-box replacement operation, the new state word W is obtained i, 0≤i≤7. The decimal representation of the inverse S-box is: {0,131,98,183,246,85,188,41,86,213,230,35,147,160,120,219,251,60,28,196,244,30,123,125,158,61,95,206,66,141,69,38,232,149,16,223,117,172,195,192,254,186,21,100,224,53,44,52,215,101,214,142,205,189,167,45,46,8,182,155,39, 24,225,56,70,236,107,174,104,140,118,139,239,88,127,159,111,9,121,132,209,97,255,198,15,133,5,65,3,87,200,10,89,143,113,31,137,187,170,178,79,208,49,84,99,82,248,90,216,115,134,114,42,242,7,164,50,212,157,2,17,32,34,37,217,74,179,10 9,162,72,4,161,13,63,237,152,184,103,173,11,185,57,199,51,145,146,253,67,12,168,136,226,68,83,78,156,163,62,71,80,243,154,194,40,191,6,153,171,228,119,124,201,250,54,94,151,76,221,135,234,18,193,75,122,249,144,166,245,77,112,58,1,2 7,235,47,29,169,252,203,207,14,59,241,20,247,64,218,177,222,19,48,106,105,240,126,148,180,150,210,33,202,36,231,26,55,190,204,102,165,96,81,130,238,176,22,116,25,175,93,211,138,92,110,229,233,227,43,91,73,23,129,108,220,197,181,128}

[0044] The new 8 status words W are obtained iArrange them in order to form a 64-bit group P = {P0, P1, P2, ..., P 62 ,P 63}.

[0045] The round key addition refers to: adding the current round key K r In order from high to low, it is recorded as K r ={k0,k1,k2,…,k 63}, for i = 0, 1, ..., 63, calculate:

[0046] The inverse linear layer permutation means: P = {P0, P1, P2, ..., P 62 ,P 63}After the reverse permutation of the encryption operation, we get the next round of C={C0,C1,C2,…,C 62 ,C 63}.

[0047] Table 2 shows the correspondence between linear layer permutations during the decryption process.

[0048]

[0049] After specific actual experiments, when the 128-bit master key is set to all 0s (0000 0000 0000 00000000 0000 0000 0000), the round keys are (in hexadecimal):

[0050] Round 01: 0000 0000 FFFF 0000

[0051] Round 02: 0002 0420 FDF6 0816

[0052] Round 03: 0000 0CB0 BDB2 2C90

[0053] 04 round: 0020 252B 3F73 1430

[0054] Round 05: 0302 4861 65B7 0713

[0055] 06 wheel: C04E 4525 D5F8 D026

[0056] 07 round: 185A 00DC 4DC5 105F

[0057] 08 round: 72A0 85A6 453F 73A8

[0058] 09 round: 460A 4316 F0D5 561E

[0059] 10th round: 01B2 2526 94D7 0136

[0060] Round 11: AD40 6A88 DA87 A5C7

[0061] 12 rounds: 1802 C2CC ​​2E6D 3006

[0062] Round 13: 6420 012964BB 2423

[0063] 14th round: 0228 440F 9E37 8228

[0064] 15 rounds: 147C 4622 77F7 367F

[0065] 16 wheels: 590E 0B76 5DB5 41BA

[0066] Round 17: 3E02 2EC4 CEE7 FC81

[0067] 18 rounds: B2DC 48A4 1703 B3DC

[0068] Round 19: 4EC7 58FC C49C CAD3

[0069] 20 rounds: 9740 265B 3109 B648

[0070] 21 rounds: DF8C 6F09 3E03 ED8F

[0071] 22 rounds: DB6E 3529 A3E2 F9CC

[0072] 23 rounds: ABE6 19CF C4AF 6B45

[0073] 24 rounds: DD01 4CE0 A0C3 7DC3

[0074] 25 rounds: D805 E5A8 E0F3 3896

[0075] 26 rounds: 8ABB 560E EEF3 2EE9

[0076] 27 rounds: 625F A074 8437 667D

[0077] 28 rounds: 7A48 DA2F 0003 7A48

[0078] Round 29: FCB2 8FA6 6859 FCBA

[0079] 30 rounds: 8DE9 CC93 4885 856D

[0080] Algorithm encryption test vector (TestVector): Calculate the ciphertext data when the master key is all 1 and all 0 respectively, and the plaintext data is all 1 and all 0 respectively. Table 3 is the test vector of Tenon algorithm (in hexadecimal).

[0081]

[0082] Compared with the prior art, the present invention has significant advantages in hardware resource consumption and achieves a better balance between security and implementation performance. In the nonlinear layer, the S-box used consumes less hardware resources than the same type of 8-bit S-box or even some 4-bit S-boxes. Each S-box replacement operation consumes 1 NOT gate, 2 AND gates and 4 XOR gates, a total of about 1×0.5+2×1.3+4×2.65=13.7 standard gate circuits (GE). In contrast, the 4-bit S-box used by the existing popular lightweight block cipher algorithm PRESENT-80 consumes about 28 standard gate circuits. When the packet length is 64 bits, PRESENT needs to use 16 S-boxes in one round, occupying a total of 28×16=448GE. The Tenon of the present invention only needs to use 8 S-boxes in one round, occupying 13.7×8=109.6GE. In addition, the linear layer used in this algorithm is a bit-level wire replacement, which does not require redundant hardware resources to implement.

[0083] In terms of security, the S-box used in the algorithm also has good cryptographic properties, with a differential uniformity of 8, a nonlinearity of 96, and an algebraic order of 7. The 8-bit S-box used has a stronger ability to resist attacks than the 4-bit S-box. In the linear layer, the bit-slice technology is applied, so that each bit output by the same S-box enters a different S-box in the next round of encryption, and each bit input to the same S-box in the next round comes from the output of different S-boxes in the previous round. If the S-box is regarded as a bijective function without considering the specific input-output correspondence, the minimum number of active S-boxes in the algorithm under 30 rounds is obtained by MILP (mixed integer linear programming), which is 44, and the security is not weaker than the result of the PRESENT-80 algorithm.

[0084] The above-mentioned specific implementation can be partially adjusted in different ways by those skilled in the art without departing from the principle and purpose of the present invention. The protection scope of the present invention shall be based on the claims and shall not be limited by the above-mentioned specific implementation. Each implementation scheme within its scope shall be subject to the constraints of the present invention.

Claims

1. An encryption method based on a lightweight block cipher tenon-type algorithm, characterized in that: The data to be encrypted is divided into plaintext blocks P of equal length according to the block length of each group of n bits, and the master key K is set to m1 bits in length. The master key K is used to generate the round keys of the Tenon block cipher algorithm through the key scheduling algorithm. 1≤r≤30, length is m2 bits, m1=128, m2=64. During the encryption process, the input data to be encrypted is subjected to R rounds of iterative encryption operations, and an n-bit ciphertext block C is output; The encryption method specifically includes: Step 1) Divide the data to be encrypted into plaintext groups P of equal length according to the group length, each group of n bits, where n=64; Step 2) Set the master key K, which is m1 bits long, and generate the round keys of the Tenon block cipher algorithm from the master key K through the key scheduling algorithm 1≤r≤30, length is m2 bits, m1=128, m2=64, specifically: for the rth round key, the first The bits are assigned to the 64-bit round key in sequence. For example, for the first round, the 1st, 2nd, 4th, 7th, ..., 97th bits of the master key are assigned to the 0th, 1st, 2nd, ..., 63rd bits of the round key in sequence; Divide into 4 groups according to 16-bit length For the round number r, it is represented as a 5-bit binary number, with the rightmost bit being the low bit: for example, for the round number r = 11, it is represented as 01011; then:

1. The 15th, 16th, 31st, 47th, and 63rd bits in the round key are ANDed with the five bits of the binary representation of r in sequence, and the result is updated to the new k 15 ,k 16 ,k 31 ,k 47 ,k 63 2. The 16 bits of the bit are bitwise inverted to get the new k 32 k 33 …k 47 ; 3. k 48 k 49 …k 63 With k 32 k 33 …k 47 After the bitwise AND operation, and then with k0k1…k 15 Perform bitwise XOR operation to get the new k 48 k 49 …k 63 ; 64-bit k0k1…k after update 63 Divided into 4 groups according to 16-bit length That is the round key of the rth round, and the master key is updated to 128 bits Step 3) During the encryption process, the input data to be encrypted is subjected to R rounds of iterative encryption operations, and the ciphertext is output, specifically: 3.1) For R = 1, 2, 3, ..., 29 rounds, in each round of encryption: the n-bit plaintext group P is combined with the m2-bit round key K of the i-th round i After the round key is added, it is divided into 8 8-bit bytes, which are replaced by nonlinear layer S-boxes and linear layer permutations in turn, and the output data is used as the input for the next round; Positive integer n=64; m1=128; m2=64; R=30; 3.2) For R = 30 rounds, the n-bit group P is combined with the m2-bit round key K of the i-th round i After the round key is added, it is divided into 8 8-bit bytes, and after nonlinear layer S-box replacement, the final 64-bit ciphertext block C is directly output; The round key addition is specifically implemented as follows: the 64-bit plaintext group P input in each round is represented from high to low as {P0, P1, P2, ..., P 62 ,P 63 }, the 64-bit round key K of the rth round r From high to low, it is represented as {k0,k1,k2,k3,…,k 61 ,k 62 ,k 63 }, bitwise change P i With k i XOR is performed to obtain a new plaintext group P = {P0, P1, P2, ..., P 62 ,P 63 }, 0≤i≤63; The specific implementation of the nonlinear layer S-box replacement is: the plain text P after round key addition is 62 ,P 63 }From high to low, every 8 bits are divided into a group, and 8 8-bit byte groups are obtained, recorded as W0, W1, W2, W3, W4, W5, W6, W7, where W i ={w 8i+0 ,w 8i+1 ,w 8i+2 ,w 8i+3 ,w 8i+4 ,w 8i+5 ,w 8i+6 ,w 8i+7 }, 0≤i≤7, W0, W1, W2, W3, W4, W5, W6, W7 are simultaneously passed through 8 juxtaposed S-boxes. The specific process is to take eight identical 8-bit input and 8-bit output S-box transformations. The transformation is to transform W i As an 8-bit input, it is processed by S-box to obtain a new 8-bit output W' i ={w' 8i+0 ,w' 8i+1 ,…,w' 8i+6 ,w' 8i+7 }=S(W i )=S({w 8i+0 ,w 8i+1 ,…,w 8i+6 ,w 8i+7 }), the Tenon algorithm S-box is constructed based on an 8-stage nonlinear feedback shift register. An S-box operation requires 11 iterations. The output of the previous beat will be used as the input of the next beat. In each beat, the sixth bit of the input is used as the first bit of the output; the third bit of the input is inverted and then ANDed with the eighth bit, and then XORed with the fifth bit and the sixth bit to obtain the second bit of the output; the second bit of the input is used as the third bit of the output; the eighth bit of the input is used as the fourth bit of the output; the sixth bit of the input is used as the seventh bit of the output; the fourth bit of the input is used as the sixth bit of the output; the third bit of the input is used as the seventh bit of the output; the sixth bit of the input is first ANDed with the eighth bit and then XORed with the first bit and the fifth bit to obtain the eighth bit of the output. After the above 11 beats of operation, the outputs of the 8 juxtaposed S-boxes are W'0, W'1, W'2, W'3, W'4, W'5, W'6, W'7, which are combined from high to low into 64 bits C = {C0, C1, C2, ..., C 62 ,C 63 }; The linear layer permutation is as follows: the 64 bits after the nonlinear layer S-box replacement operation are permuted at the bit level. The specific process is that the 64 bits replace the output 8 bits to the new position in the order of 8 S-boxes: W i The 8-bit output W' is obtained after an S-box substitution I ={w' 8i+0 ,w' 8i+1 ,w' 8i+2 ,w' 8i+3 ,w' 8i+4 ,w' 8i+5 ,w' 8i+6 ,w' 8i+7 } is transformed into {C [8(iI1)]mod64+(2i+1)mod8 ,C [8(iI2)]mod64+(2i+2)mod8 ,C [8(iI3)]mod64+(2i+3)mod8 ,C [8(iI4)]mod64+(2i+4)mod8 ,C [8(i+5)]mod64+(2i+5)mod8 ,C [8(i+6)]mod64+(2i+6)mod8 ,C [8(i+7)]mod64+(2i+7)mod8 ,C [8(i+8)]mod64+(2i+8)mod8 }, where: 0≤i≤7.

2. The decryption method according to claim 1, characterized in that: include: The key scheduling algorithm generates round keys, nonlinear layer inverse S-box substitution, round key addition and linear layer inverse permutation.

3. The decryption method according to claim 2, characterized in that: In the key scheduling algorithm described above: the nonlinear layer inverse S-box is used to divide the 64-bit ciphertext group C into 8 groups according to the 8-bit width, and the i-th group is recorded as W' i = w' 8i+0 ,w' 8i+1 ,w' 8i+2 ,w' 8i+3 ,w' 8i+4 ,w' 8i+5 ,w' 8i+6 ,w' 8i+7 },0≤i≤7, and W' i After inverse S-box substitution, we get W i , wherein the selected inverse S-box is described in the specific implementation manner; The round key addition operation is the same as the round key addition described in step 3.1; the inverse linear layer transform is to convert the ciphertext group C into {C [8(i+1)]mod64+(2i+1)mod8 ,C [8(i+2)]mod64+(2i+2)mod8 ,C [8(i+3)]mod64+(2i+3)mod8 ,C [8(i+4)]mod64+(2i+4)mod8 ,C [8(i+5)]mod64+(2i+5)mod8 ,C [8(i+6)]mod64+(2i+6)mod8 ,C [8(i+7)]mod64+(2i+7)mod8 ,C [8(i+8)]mod64+(2i+8)mod8 }Transform to W' i ={w' 8i+0 ,w' 8i+1 ,w' 8i+2 ,w' 8i+3 ,w' 8i+4 ,w' 8i+5 ,w' 8i+6 ,w' 8i+7 }, which is the opposite of the wire permutation chosen during encryption.

4. The decryption method according to claim 3, characterized in that: For R=30, only two operations need to be performed on the ciphertext group C: inverse S-box substitution and round key addition; for 1≤R≤29, the decryption process needs to perform three operations of linear layer inverse permutation, inverse S-box substitution and round key addition in sequence to finally obtain the correct plaintext group P.

Citation Information

Patent Citations

  • Method and apparatus for implementing lightweight block cipher SCS

    CN108123791A

  • IN102010400003910