CN116743352A - Encryption and decryption realization method of novel dynamic block cipher HFSP with consistent encryption and decryption - Google Patents

Encryption and decryption realization method of novel dynamic block cipher HFSP with consistent encryption and decryption Download PDF

Info

Publication number
CN116743352A
CN116743352A CN202310437143.8A CN202310437143A CN116743352A CN 116743352 A CN116743352 A CN 116743352A CN 202310437143 A CN202310437143 A CN 202310437143A CN 116743352 A CN116743352 A CN 116743352A
Authority
CN
China
Prior art keywords
round
key
exclusive
iteration
bits
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202310437143.8A
Other languages
Chinese (zh)
Inventor
崔嘉琛
李浪
匡娟丽
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Hengyang Normal University
Original Assignee
Hengyang Normal University
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Hengyang Normal University filed Critical Hengyang Normal University
Priority to CN202310437143.8A priority Critical patent/CN116743352A/en
Publication of CN116743352A publication Critical patent/CN116743352A/en
Pending legal-status Critical Current

Links

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L9/00Cryptographic mechanisms or cryptographic arrangements for secret or secure communications; Network security protocols
    • H04L9/06Cryptographic mechanisms or cryptographic arrangements for secret or secure communications; Network security protocols the encryption apparatus using shift registers or memories for block-wise or stream coding, e.g. DES systems or RC4; Hash functions; Pseudorandom sequence generators
    • H04L9/0618Block ciphers, i.e. encrypting groups of characters of a plain text message using fixed encryption transformation
    • H04L9/0625Block ciphers, i.e. encrypting groups of characters of a plain text message using fixed encryption transformation with splitting of the data block into left and right halves, e.g. Feistel based algorithms, DES, FEAL, IDEA or KASUMI
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L9/00Cryptographic mechanisms or cryptographic arrangements for secret or secure communications; Network security protocols
    • H04L9/06Cryptographic mechanisms or cryptographic arrangements for secret or secure communications; Network security protocols the encryption apparatus using shift registers or memories for block-wise or stream coding, e.g. DES systems or RC4; Hash functions; Pseudorandom sequence generators
    • H04L9/0618Block ciphers, i.e. encrypting groups of characters of a plain text message using fixed encryption transformation
    • H04L9/0631Substitution permutation network [SPN], i.e. cipher composed of a number of stages or rounds each involving linear and nonlinear transformations, e.g. AES algorithms
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L9/00Cryptographic mechanisms or cryptographic arrangements for secret or secure communications; Network security protocols
    • H04L9/08Key distribution or management, e.g. generation, sharing or updating, of cryptographic keys or passwords
    • H04L9/0861Generation of secret information including derivation or calculation of cryptographic keys or passwords

Abstract

The invention discloses a method for realizing encryption and decryption of a novel dynamic block cipher HFSP with consistent encryption and decryption, which comprises the following steps: and obtaining data to be encrypted and an initial key, wherein each round of operation comprises FRX structure transformation and key arrangement operation from round 0 to round 1. The invention associates the key arrangement part with prime numbers and linear congruence equations, and respectively carries out different operations on prime number rounds and the congruence rounds, thereby achieving the effect of dynamic generation of the key. In addition, the novel algorithm structure and the construction method of the key arrangement not only reduce the consumption of hardware resources in the decryption process of the algorithm, but also improve the security of the algorithm by hiding the relation between the keys.

Description

Encryption and decryption realization method of novel dynamic block cipher HFSP with consistent encryption and decryption
Technical Field
The invention belongs to the technical field of information security encryption, and particularly relates to an encryption and decryption realization method of a novel dynamic block cipher HFSP with consistent encryption and decryption.
Background
With the rapid development of computer and network technologies, the demands of various industries for information construction on network security integral solutions are gradually increasing, and symmetric passwords become a core foundation for constructing a security information system. Block ciphers, which are an important branch of symmetric encryption, have an extremely important role in information security, and have been a hot spot of research. The design of block ciphers has also been following the "confusion" and "diffusion" principles proposed by shannon.
Since linear attacks and related key attacks have been proposed, cryptographic algorithms have been used in different ways to combat these two attacks, and their core ideas can be broadly divided into two categories: the first type of them employs a linear approximation of block ciphers to implement key recovery attacks, known as plaintext attacks. The linear differentiator can be utilized to convert into a key recovery attack on the r round password. Under the guidance of this principle, the algorithm carefully selects complex key orchestration operations and encryption function operations that are closely related thereto. And the key arrangement is used as an important component operation in a modern cryptographic algorithm, a key with low linear probability is selected, and exclusive OR is carried out with plaintext in an encryption flow, so that the linear correlation of the algorithm is reduced.
Another type of attack is where the attacker does not know the key, but the attacker can choose other keys with a specific relationship to the current key and access the plaintext obtained by encryption of the original key and its associated key. And selecting a proper key relation by utilizing the weakness of the key arrangement scheme, so as to obtain the association between the original key and the corresponding cipher algorithm under the related key, and recovering the original key. If the key orchestration scheme is highly nonlinear, the master key differencing that satisfies the differencing chain requirements may be unknown, which increases the difficulty of an attacker's attack. Therefore, specific analysis is required for the key arrangement, whether linear or related key attack, so that the cryptographic algorithm can resist linear attack and related key attack by adopting a complex key arrangement scheme.
Among the block cipher algorithms, there are three kinds of cipher structures, a Feistel network structure, an SP network structure and a Lai-Massey network structure, among which the Feistel network structure and the SP network structure are the two most commonly used cipher structures. However, the block cipher of the SP network architecture is favored by a wide range of block cipher designers because the SP network architecture enables faster implementation confusion and diffusion than the block cipher of the Feistel network architecture. For the traditional Feistel network structure password, only a part of the password is mixed and diffused each time, so that each bit can be converted through two rounds of conversion, the SP network structure password only needs one round, all the bits are changed, but each part needs to be inverted during decryption, and extra hardware resources are consumed.
Disclosure of Invention
The invention aims to provide a realization method of a novel dynamic block cipher HFSP with consistent encryption and decryption, which utilizes the complexity of increasing the cipher key arrangement, namely, generates sub-cipher keys in different 2 modes by judging whether the number of rounds is prime or not, so that the cipher key presents a dynamic form in the whole encryption flow, thereby increasing the integral security of an algorithm, and by constructing an algorithm structure FRX with consistent encryption and decryption, not only can all bits be changed in one round, but also the resource consumption of the algorithm on hardware can be reduced. Where H in HFSP is an abbreviation representing the operational structure of the present invention like the letter H, F refers to the FRX structure used in the present invention, which refers to F function (function), cyclic shift (rotation), bitwise bit exclusive or (bitwise XOR). SP in HFSP refers to the operation of the FRX structure that involves S-box and P-substitution.
In order to achieve the technical purpose, the technical scheme of the invention is that,
a method for realizing encryption of a novel dynamic block cipher HFSP with consistent encryption and decryption comprises the following steps:
setting a 128-bit Key and performing shift operation to obtain k a
Step two, according to the number of current iteration rounds, for k a Two different split-wheel operations are performed. Wherein the first minute wheel operation is: will k a And S-box replacement is carried out to obtain 128-bit data ks, and then P replacement is carried out on the ks to obtain keys.
The second type of minute wheel operation is: will k a S box replacement is carried out to obtain 128-bit data ks, and then the data ks is obtained according to the current iteration roundWhether the number is larger than a preset value or not, performing two different sub-round operations: when not greater than the preset value the sub-division operation of (2) is as follows: and performing exclusive OR on ks and the number of the current iteration round number to obtain kx. When the value is larger than the preset value the sub-division operation of (2) is as follows: and performing exclusive OR on ks and the generated number X to obtain kx. And finally P-displacing kx to obtain a key.
Then save the key and take the key as k a For the next iteration and then the key is used as the key for the iteration of this round.
And thirdly, based on the key, sequentially executing FRX structure transformation including high round key exclusive OR, first round cyclic shift, first round constant exclusive OR, F function, second round constant exclusive OR, second round cyclic shift and low round key exclusive OR on the 64-bit plaintext to be encrypted, and taking the obtained result as the plaintext to be encrypted in the next round of iteration. Wherein the F function includes an initial permutation, an S-box permutation, and an initial inverse permutation, which are performed sequentially.
And fourthly, checking the current iteration times, and returning to the second step for iteration continuously if the current iteration times do not reach the preset iteration times. And otherwise, outputting the result of the step three as encrypted ciphertext.
In the encryption implementation method, in the first step, the shift operation includes the following steps:
the 128-bit key is divided into 16 8-bit bytes and sequentially arranged to form a 4×4 matrix, and then the 1 st row and the 3 rd row of the matrix are interchanged, and the 2 nd row and the 4 th row are interchanged, thereby realizing a shift operation.
In the encryption implementation method, in the second step, the round-robin operation is executed according to the number of rounds of the current iteration, namely, the number of iteration rounds is set to be multiple rounds of iterations starting from the 0 th round, the first round-robin operation is executed when the number of iteration rounds is the number of the complex rounds, the second round-robin operation is executed when the number of the iteration rounds is the prime number, and the first round-robin operation is executed by both the 0 th round and the 1 st round.
In the encryption implementation method, in the second and third steps, the S box replacement includes:
the S box replacement is completed by adopting logic operation or table lookup, wherein the operation formula of the logic operation is as follows:
wherein a, b, c and d respectively represent 4 bits from high order to low order of the 4-bit binary number, a ', b', c 'and d' are obtained through transformation, and are recombined into the 4-bit binary number, and the range of binary number conversion into decimal number is 0-15.
The table lookup is performed according to a preset S-box substitution table, wherein the S-box substitution table is obtained based on the result of the logic operation.
In the encryption implementation method, in the second step, P permutation is performed on 128-bit data by using each bit as a unit, where the permutation is performed according to a preset P permutation table. In the encryption implementation method, in the second step, the generation number X is obtained through the following steps:
where RD represents the number of rounds of the current iteration and mod represents the remainder operation.
The encryption implementation method comprises the following steps:
first, the key takes the upper 64 bits as the key left branch K 0 The lower 64 bits are the key right branch K 1 . And takes the 64-bit plaintext to be encrypted as the left branch P of the plaintext by using the upper 32 bits 0 The lower 32 bits are taken as the right branch P 1
Then branch left plaintext P 0 Left branch of AND key K 0 Exclusive OR is performed on the upper 32 bits of the L-bit block to obtain Lp 1 At the same time branch the plaintext right P 1 Left branch of AND key K 0 Exclusive or is performed on the upper 32 bits of (2) to obtain Rp 1 Thereby completing the high round key exclusive or.
And then Lp 1 Circularly shifting left by 9 bits to obtain Ls 1 Right branch Rp 1 Right shift by 9 bits circularly to obtain Rs 1 Thereby completing the first cyclic shift.
Executing the first round constant exclusive OR, setting the iteration round number to be from the 0 th round, and when the current iteration round number is odd, ls 1 Constant r of the wheel 3 Performing exclusive OR to obtain Lp 2 ,Rs 1 Constant r of the wheel 4 Performing exclusive OR to obtain Rp 2 . When the number of rounds of the current iteration is even, ls 1 Constant r of the wheel 1 Performing exclusive OR to obtain Lp 2 ,Rs 1 Constant r of the wheel 2 Performing exclusive OR to obtain Rp 2 . Wherein the wheel constant is a preset value.
And then to Lp 2 Performing an F function including initial permutation, S-box permutation, and initial inverse permutation to obtain Lp 3 ,Rp 2 Also execute F function to get Rp 3
Executing the constant exclusive OR of the second round, setting the iteration round number to be from the 0 th round, and when the round number of the current iteration is odd, lp 3 Constant r of the wheel 3 Performing exclusive OR to obtain Lp 4 ,Rp 3 Constant r of the wheel 4 Performing exclusive OR to obtain Rp 4 The method comprises the steps of carrying out a first treatment on the surface of the When the number of the current iteration turns is even, lp 3 Constant r of the wheel 1 Performing exclusive OR to obtain Lp 4 ,Rp 3 Constant r of the wheel 2 Performing exclusive OR to obtain Rp 4 The method comprises the steps of carrying out a first treatment on the surface of the Wherein the wheel constant is a preset value;
and then to Lp 4 Performing circular right shift for 9 bits to obtain Ls 2 ,Rp 4 Circularly shifting left by 9 bits to obtain Rs 2 Thereby completing the second cyclic shift.
Finally Ls is added 2 Right branch of AND key K 1 Exclusive OR is performed on the upper 32 bits of the L-bit block to obtain Lp 5 Rs will be 2 Right branch of AND key K 1 Exclusive or is performed on the upper 32 bits of (2) to obtain Rp 5
The Lp obtained was then used 5 And Rp 5 As P in the next round of iteration 0 And P 1 And (3) finishing the step three.
The encryption implementation method includes the steps that F functions including initial replacement, S-box replacement and initial inverse replacement are as follows:
initial replacement: using initial substitution table, lp in class DES algorithm 2 Completion of the diffusion operation by querying the initial substitution table to obtain Lp 2 ' Rp is taken as 2 Completing diffusion operation by querying initial substitution table to obtain Rp 2 ′。
S box replacement: by adopting a S-box replacement mode of logic operation or table lookup, the result Lp obtained by the initial replacement operation is obtained 2 ' and Rp 2 ' transform separately.
Initial reverse substitution: an initial reverse substitution table in the class-DES algorithm is adopted to complete Lp of S-box substitution operation 2 ' and Rp 2 ' query initial reverse substitution table to complete diffusion operation to obtain Lp 3 And Rp 3
The decryption implementation method of the novel dynamic block cipher HFSP with consistent encryption and decryption uses the encrypted ciphertext output by the encryption implementation method as a decryption object, and iteratively executes the step three as in the encryption implementation method on the ciphertext, wherein the iteration round number is the same as that of the encryption implementation method, but the round number in the iteration process is the inverse of the round number from back to front, and the keys corresponding to the round number are used for decryption by reversing the round number from front to back.
The invention designs a novel cipher structure FRX, which is another novel cipher structure capable of achieving encryption and decryption consistency effect by distinguishing 3 major main stream cipher structures, and the key of the encryption and decryption consistency is that the FRX is structured in a symmetrical form up and down, and initial replacement and initial reverse replacement in a PSP structure are not counteracted, and an adopted S box can achieve the cipher property, so that the security of an algorithm is ensured. The design of the dynamic key arrangement part dynamically generates the sub-keys by adopting random number exclusive OR operation related to the round counter and round operation of prime number round and synthetic number round, thus greatly reducing the linear correlation between each round of keys, improving the safety of algorithm and reducing the area of hardware realization.
Drawings
Fig. 1 is a flowchart of the algorithm encryption according to the present invention.
Fig. 2 is a flow chart of the key arrangement according to the present invention.
Fig. 3 is a flow chart of F functions in the encryption algorithm structure according to the present invention.
Detailed Description
The encryption and decryption implementation method of the novel dynamic block cipher HFSP with consistent encryption and decryption provided by the embodiment is characterized in that the initial iteration is marked as the 0 th round, and each round of iteration operation comprises FRX structure transformation and key arrangement operation.
Referring to fig. 1, the FRX structure transformation of the present embodiment includes performing high round key exclusive-or, first round cyclic shift, first round constant exclusive-or, F function, second round constant exclusive-or, second round cyclic shift, low round key exclusive-or on the data of the packet.
Referring to fig. 3, the F-function structure transformation of the present embodiment includes initial permutation of data completing the first round of constant exclusive or, S-box substitution, initial inverse permutation.
Referring to fig. 2, the key arrangement includes performing a row shift on the key (in this embodiment, only the 0 th round needs to perform a row shift operation on the key, and the other 1 to 15 rounds do not need to perform a row shift operation), then sequentially performing round operations, sequentially performing S-box replacement, random number exclusive or, and P replacement on the key that is the prime round and has a round counter greater than 3 according to the round result, sequentially performing S-box replacement, round counter exclusive or, and P replacement on the key that is the prime round and has a round counter less than or equal to 3, and sequentially performing S-box replacement and P replacement on the key that is the combined round.
The implementation method of the novel dynamic block cipher HFSP with consistent encryption and decryption provided by the embodiment solves the problem that the traditional Feistel network structure cannot realize one round of full diffusion and solves the problem that the traditional SP network structure cannot realize consistent encryption and decryption through the novel cipher structure FRX structure. Meanwhile, the key arrangement part is associated with prime numbers and linear congruence equations, and the key is integrally divided into two dynamic operation flows by judging whether the round constants are prime numbers or not, so that the key is in a dynamic form in the whole encryption flow, the safety of an algorithm is improved by hiding the relation between the keys, and the consumption of hardware resources is reduced. The invention is further illustrated below with reference to examples. The present embodiment uses a plaintext of 64 bits in length, a 128 bit length key, and 16 iterations. In practice, more or fewer bits of plaintext, more or fewer bits of key, and more or fewer rounds of iteration may be employed as desired. Wherein the number of iteration rounds is generally not less than 16 rounds for the purpose of ensuring encryption security.
The encryption and decryption implementation method of the novel dynamic block cipher HFSP with consistent encryption and decryption provided by the embodiment comprises the following steps:
step 1: obtaining 64-bit Plaintext as data to be encrypted from high order to low order for input plantext=p 63 p 62 …p 1 p 0 The 64-bit plain text is equally divided into two groups, and the number of rounds Nr is determined to be 16. The specific process of the grouping is as follows:
let each group denote Pi (i=0, 1), left branch P 0 =p 63 ||p 62 …p 33 ||p 32 Right branch P 1 =p 31 ||p 30 …p 1 ||p 0
step 2: obtaining a 128-bit Key Key as an initial sub-Key k, and performing shifting operation on the sub-Key k to obtain k a . The specific process of the row shift is as follows:
dividing 128 bits k into 16 8-bit bytes, a respectively 15 、a 14 、a 13 、a 12 、a 11 、a 10 、a 9 、a 8 、a 7 、a 6 、a 5 、a 4 、a 3 、a 2 、a 1 、a 0 Drawn as a 4 x 4 matrix, a 15 ||a 14 ||a 13 ||a 12 Data a arranged in row 0, the next least significant 8 bits 11 ||a 10 ||a 9 ||a 8 Data a arranged in row 1, next most significant 8 bits 7 ||a 6 ||a 5 ||a 4 Data a of 8 bits arranged in row 2 and most significant 3 ||a 2 ||a 1 ||a 0 Arranged in the last row, set the ith row A i (i=0, 1,2, 3), the specific arrangement form is as follows. For convenience of description, the matrix is represented in two dimensions, i.e. behavior 0 a 0,3 ||a 0,2 ||a 0,1 ||a 0,0 Behavior 1 a 1,3 ||a 1,2 ||a 1,1 ||a 1,0 Behavior 2 a 2,3 ||a 2,2 ||a 2,1 ||a 2,0 Behavior 3 a 3,3 ||a 3,2 ||a 3,1 ||a 3,0 The two-dimensional arrangement is as follows:
then the 0 th row and the 2 nd row are exchanged with the 1 st row and the 3 rd row to obtain a subkey k a The following figures:
step 3: according to the mathematical property of the round counter RD, that is, according to whether the numerical value is prime or composite, the round counter RD is divided into prime rounds and composite rounds, and since it is determined in the present invention that Nr is 16, but 0 and 1 are neither prime nor composite, in this embodiment, the 0 th round and the 1 st round are classified into composite rounds to be operated, and there are 2 nd, 3 RD, 5 th, 7 th, 11 th and 13 th rounds to be operated. The number of the operations of the combination wheels is 0,1, 4, 6, 8, 9, 10, 12, 14 and 15.
step 4: k obtained by step2 a According to the step 3, different operations are respectively carried out.
The operation process of the round operation is as follows:
a1: the combining round will then sub-key k a Enter key S boxAnd (3) finishing nonlinear operation to obtain 128-bit data ks, and then performing P replacement on ks to finish diffusion operation to obtain keys.
Prime number round then first uses sub key k a And (3) entering a key S box to complete nonlinear operation to obtain 128-bit data ks, and carrying out further round division according to whether round count RD is greater than 3.
A2: if the round counter is less than or equal to 3, performing exclusive or on the newly obtained ks and the round counter RD to obtain kx, wherein the formula is as follows:
if the round counter is greater than 3, the newly obtained ks is exclusive-ored with a random number X to obtain kx, wherein X is generated by a linear congruence equation set related to the round counter RD, and the main formula is as follows:
where RD represents the number of rounds of the current iteration and mod represents the remainder operation.
A3: p substitution is carried out on the obtained 128-bit kx to finish diffusion operation, and a key is obtained.
step 5: judging whether the current round counter RD is smaller than 15, if yes, letting RD=RD+1, and assigning k to the key as the data input by the next round a And stores the keys for each round, returning to step4. Otherwise, only the key is stored, and no further operation is performed.
step 6: key=k of 128 bits to be used in this round 127 k 126 …k 0 The left branch and the right branch are obtained according to the upper 64 bits and the lower 64 bits, and the specific process is as follows:
let each group denote Ki (i=0, 1), left branch K 0 =k 127 ||k 126 …||k 64 Right branch K 1 =k 63 ||k 62 …||k 0
step 7: left branch P of plaintext 0 Left branch of AND key K 0 Exclusive OR is performed on the upper 32 bits of the L-bit block to obtain Lp 1 At the same time branch the plaintext right P 1 Left branch of AND key K 0 Exclusive or Rp is performed on the upper 32 bits of (2) 1
step 8: the newly obtained left branch Lp 1 Respectively circularly shifting left by 9 bits to obtain Ls 1 At the same time, the newly obtained right branch Rp 1 Right shift by 9 bits circularly to get Rs 1
step 9: for Ls in step 8 1 And Rs (Rs) 1 According to the parity of the round counter RD, the first round constant exclusive OR is carried out respectively and simultaneously, and the specific process is as follows:
if the wheel counter RD is odd, ls 1 Constant r of the wheel 3 Performing exclusive OR to obtain Lp 2 ,Rs 1 Constant r of the wheel 4 Performing exclusive OR to obtain Rp 2
If the wheel counter RD is even, ls 1 Constant r of the wheel 1 Performing exclusive OR to obtain Lp 2 ,Rs 1 Constant r of the wheel 2 Performing exclusive OR to obtain Rp 2
Round constant exclusive-or is performed as follows in table 2:
table 2 algorithm middle round constant table
The main formula is as follows:
RD is an odd number:
RD is an even number:
step 10: lp obtained for step 9 2 F function is carried out to obtain Lp 3 At the same time Rp 2 F function is carried out to obtain Rp 3 The F function operation sequentially comprises initial replacement, S-box replacement and initial inverse replacement, and the specific process is as follows:
initial replacement: using initial substitution table, lp in class DES algorithm 2 Completion of the diffusion operation by querying the initial substitution table to obtain Lp 2 ' Rp is taken as 2 Completing diffusion operation by querying initial substitution table to obtain Rp 2 ′。
S box replacement: results Lp obtained from the initial permutation operation using the same 4*4 reflexive S-box as the key S-box 2 ' and Rp 2 ' transform separately.
Initial reverse substitution: an initial reverse substitution table in the class-DES algorithm is adopted to complete Lp of S-box substitution operation 2 ' and Rp 2 ' query initial reverse substitution table to complete diffusion operation to obtain Lp 3 And Rp 3
step 11: as with step 9, according to step 9, the parity of the round counter RD is determined to obtain Lp 3 And Rp 3 The constant exclusive OR of the second round is carried out respectively and simultaneously, and the specific process is as follows:
if the wheel counter RD is odd, lp 3 Constant r of the wheel 3 Performing exclusive OR to obtain Lp 4 ,Rp 3 Constant r of the wheel 4 Performing exclusive OR to obtain Rp 4
If the wheel counter RD is even, lp 3 Constant r of the wheel 1 Performing exclusive OR to obtain Lp 4 ,Rp 3 Constant r of the wheel 2 Performing exclusive OR to obtain Rp 4
Round constant exclusive-or is performed as follows in table 2:
table 2 algorithm middle round constant table
Wheel constant r 1 r 2 r 3 r 4
Numerical value 0x01000000 0x02000000 0x00300000 0x00040000
The main formula is as follows:
RD is an odd number:
RD is an even number:
step 12: similar to step 8, the difference is that the newly obtained left branch Lp is taken in this step 4 Respectively circularly right-shifting by 9 bits to obtain Ls 2 At the same time, the newly obtained right branch Rp 4 Left shift by 9 bits circularly to obtain Rs 2
step 13: similar to step 7, the difference is that in this step the plaintext left branch Ls is branched off 2 Right branch of AND key K 1 Exclusive OR is performed on the upper 32 bits of the L-bit block to obtain Lp 5 At the same time, right branch Rs of plaintext 2 Right branch of AND key K 1 Exclusive or Rp is performed on the upper 32 bits of (2) 5
step 14: judging whether the current round counter RD is smaller than 15, if yes, making RD=RD+1, and Lp 5 And Rp 5 As a new oneData input by the wheel are sequentially assigned to P 0 And P 1 Step2 is returned. Otherwise will Lp 5 And Rp 5 And outputting the cipheret from the high order to the low order as Ciphertext.
The decryption process of the present embodiment also performs the above steps, and since the 16 rounds of generated sub-keys are stored in the encryption process before, only 16 sub-keys (keys) are required to be decrypted 15 、key 14 ……key 1 、key 0 ) And (3) multiplexing sequentially, wherein the decryption process comprises the following steps of:
step B1: acquiring 64-bit Ciphertext as data to be decrypted cipert=c 63 c 62 …c 1 c 0 Dividing 64-bit ciphertext into two groups C 0 And C 1 And the number of rounds Nr was determined to be 16.
step B2: acquiring 128-bit key of round key stored in encryption 15 =k 127 k 126 ...k 0 And key is combined with 15 By reverse order arrangement, i.e. keys 15 =k 0 ...k 126 k 127 As the initial subkey.
step B3: acquired 128-bit key 15 As the sub-key in the round key addition, the 128-bit key is divided into left and right 2 branches according to the upper 64 bits and the lower 64 bits, namely K 0 =k 0 ||k 1 …k 62 ||k 63 And K 1 =k 64 ||k 65 …k 126 ||k 127
step B4: left branch C of ciphertext 0 Left branch of AND key K 0 Exclusive OR is performed on the upper 32 bits of (2) to obtain Lc 1 At the same time, right branch C of ciphertext 1 Left branch of AND key K 0 Exclusive or Rc is performed on the upper 32 bits of (a) 1
step B5: the newly obtained left branch Lc 1 Respectively circularly shifting left by 9 bits to obtain Ls 1 At the same time, the newly obtained right branch Rc 1 Right shift by 9 bits circularly to get Rs 1
step B6: for Ls in step B5 1 And Rs (Rs) 1 Based on the parity of the round counter RD, the first and second processes are performed simultaneouslyObtaining Lc by exclusive OR of the secondary constants 2 And Rc 2
step B7: lp obtained for step B6 2 Performing F function to obtain Lc 3 At the same time Rp 2 Performing F function to obtain Rc 3
The F function operation sequentially comprises initial permutation, S-box replacement and initial inverse permutation.
step B8: as with step B6, lc is obtained by determining the parity of step B5 to the round counter RD 3 And Rc 3 Respectively and simultaneously carrying out constant exclusive OR for the second round to obtain Lc 4 And Rc 4
step B9: similar to step B5 procedure, the difference is that the newly obtained left branch Lc is taken in this step 4 Respectively circularly right-shifting by 9 bits to obtain Ls 2 At the same time, the newly obtained right branch Rc 4 Left shift by 9 bits circularly to obtain Rs 2
step B10: similar to step B4, the difference is that the ciphertext left branch Ls is branched in this step 2 Right branch of AND key K 1 Exclusive OR is performed on the upper 32 bits of (2) to obtain Lc 5 At the same time, right branch Rs of plaintext 2 Right branch of AND key K 1 Exclusive or Rc is performed on the upper 32 bits of (a) 5
step B11: judging whether the current round counter RD is greater than 0, if so, making RD=RD-1, and Lc 5 And Rc 5 As the data input in the new round, the data are assigned to C in turn 0 And C 1 Step B2 is returned. Otherwise Lc will be 5 And Rc 5 And outputting the blocks from the upper position to the lower position sequentially as plaintext plant.
The algorithm in this embodiment is named HFSP, the algorithm packet length is 64 bits, the key length is 128 bits, and the number of iteration rounds is 16. The algorithm adopts an FRX structure, and the F function comprises initial permutation, S-box replacement and initial inverse permutation. Dynamic key orchestration includes row shifting, S-box substitution, random number exclusive-or, round counter exclusive-or, P-permutation. Since the row shift module and the round counter exclusive or module in the dynamic key arrangement have been described in detail above, they will not be described in detail. The F function individual modules and other modules of the dynamic key orchestration are described in detail below.
As shown in fig. 3, the F function includes an initial permutation, an S-box substitution, and an initial inverse permutation.
Initial permutation IP: by researching the rule of the initial substitution table IP of the DES, a 32-bit initial substitution IP is constructed, the initial substitution IP acts on data obtained after the left branch and the right branch finish the first round of constant exclusive OR, the diffusion effect is realized, substitution operation is carried out on 32-bit data by taking each bit as a unit, and the initial substitution table IP is shown in a table 3.
Table 3 initial substitution table IP in algorithm
i 0 1 2 3 4 5 6 7
IP(i) 26 18 10 2 28 20 12 4
i 8 9 10 11 12 13 14 15
IP(i) 30 22 14 06 32 24 16 06
i 16 17 18 19 20 21 22 23
IP(i) 25 17 09 01 27 19 11 03
i 24 25 26 27 28 29 30 31
IP(i) 29 21 13 05 31 23 15 07
The above table is replaced by the IP (i) value of the second row after the corresponding value is found in the table with the original data as i.
S box replacement: the method is completed by adopting logic operation or table lookup, wherein the logic operation mainly comprises the following steps: a, b, c, d represents the 4 bits from the high order to the low order of the binary number of 0-15, each 1 bit is transformed into a ', b', c ', d' according to the following alternative formula, and then rearranged and combined, wherein the logic formula is as follows:
when a lookup table is used, the substitution is performed based on the S-box element shown in table 1 below, which is obtained based on the result of the logical operation in this embodiment.
Table 1 Algorithm S box element
X 0 1 2 3 4 5 6 7 8 9 A B C D E F
S[x] C A 7 D E B F 2 9 8 1 5 0 3 4 6
In this embodiment, a 4 in and 4 out S-box is used, and the value X passing into the S-box must be one of hexadecimal 0-F. I.e. when X is one of 0-F, it is replaced by the corresponding lower value of sx according to this table. For example: when X is 6, F is replaced by S box, so the output of S box is F.
Initial reverse displacement IP -1 : by studying the initial reverse substitution table IP of DES -1 Is constructed with an initial reverse permutation IP of 32 bits -1 After the S box replacement is completed for the left branch and the right branch, performing further diffusion operation, performing substitution operation on 32-bit data by taking each bit as a unit, and initializing an inverse substitution table IP -1 As shown in table 4.
Initial reverse substitution table IP in table 4 algorithm -1
i 0 1 2 3 4 5 6 7
IP(i) -1 20 04 24 08 28 12 32 16
i 16 17 18 19 20 21 22 23
IP(i) -1 19 03 23 07 27 11 31 15
i 32 33 34 35 36 37 38 39
IP(i) -1 18 02 22 06 26 10 30 14
i 48 49 50 51 52 53 54 55
IP(i) -1 17 01 21 05 25 09 29 13
As shown in fig. 2, the dynamic key arrangement includes row shifting, S-box substitution, random number exclusive-or, round counter exclusive-or, P-permutation.
S box replacement: the same S box is adopted for nonlinear operation with the encryption flow, so that the resources consumed by hardware implementation can be reduced to a certain extent, the operation can be completed through logic operation or table lookup, and the logic formula is shown in the following table 1.
Random number or: the module is an important part for realizing dynamic key arrangement, and is mainly generated by a linear congruence equation set related to a round counter RD, a periodical array with enough large number can be generated according to the equation, and certain uniform distribution characteristics are met, and the module has the advantages that a large number of random numbers can be quickly generated, the implementation is very easy, and the main equation and the random number table 5 are as follows:
table 5: number of rounds is greater than each round of random number table that produces in prime number round of 3
Number of wheels i 5 7 11 13
The random number X generated 11 29 89 131
P replacement: the initial substitution table IP of the class DES is adopted, the law of the DES is found out by researching the initial substitution table of the DES, a 128-bit P substitution table is constructed and is used for carrying out substitution operation on 128-bit data by taking each bit as a unit in the full diffusion of the secret key, and the P substitution table is shown in a table 6.
Table 6P substitution table in algorithm
i 0 1 2 3 4 5 6 7 8 9 10 11
P(i) 0 32 64 96 1 33 65 97 2 34 66 98
i 12 13 14 15 16 17 18 19 20 21 22 23
P(i) 3 35 67 99 4 36 68 100 5 37 69 101
i 24 25 26 27 28 29 30 31 32 33 34 35
P(i) 6 38 70 102 7 39 71 103 8 40 72 104
i 36 37 38 39 40 41 42 43 44 45 46 47
P(i) 9 41 73 105 10 42 74 106 11 43 75 107
i 48 49 50 51 52 53 54 55 56 57 58 59
P(i) 12 44 73 108 13 45 77 109 14 46 78 110
i 60 61 62 63 64 65 66 67 68 69 70 71
P(i) 15 47 79 111 16 48 80 112 17 49 81 113
i 72 73 74 75 76 77 78 79 80 81 82 83
P(i) 18 50 82 114 19 51 83 115 20 52 84 116
i 84 85 86 87 88 89 90 91 92 93 94 95
P(i) 21 53 85 117 22 54 86 118 23 55 87 119
i 96 97 98 99 100 101 102 103 104 105 106 107
P(i) 24 56 88 120 25 57 89 121 26 58 90 122
i 108 109 110 111 112 113 114 115 116 117 118 119
P(i) 27 59 91 123 28 60 92 124 29 61 93 125
i 120 121 122 123 124 125 126 127
P(i) 30 62 94 126 31 63 95 127
The P replacement is to take the original data as i, and replace the corresponding value with the P (i) value of the second row.
The key generation method combines the difference of round numbers with the key generation, namely, the sub-keys are generated in different 2 modes by judging whether the round numbers are prime numbers or not, so that the key is in a dynamic form in the whole encryption process, the algorithm security is improved in a mode of reducing the correlation among the sub-keys, and the defect of stronger correlation among the sub-keys in the past is overcome.
The method of the invention comprises FRX structure transformation and key arrangement. The FRX structure transformation comprises a high round key exclusive-OR, a first round cyclic shift, a first round constant exclusive-OR, an F function, a second round constant exclusive-OR, a second round cyclic shift, and a low round key exclusive-OR. The key arrangement comprises the steps of sequentially carrying out row shifting on keys of the 0 th round, sequentially carrying out round operation, sequentially carrying out S box replacement, random number exclusive OR and P replacement on keys which are prime rounds and have round counters larger than 3 according to round results, sequentially carrying out S box replacement, round counter exclusive OR and P replacement on keys which are prime rounds and have round counters smaller than 3, and sequentially carrying out S box replacement and P replacement on keys which are combined rounds. The PSP structure transformation in the F function in the FRX structure transformation can ensure that the initial permutation and the initial inverse permutation are not counteracted, and the algorithm can reach sufficient diffusivity through 2 times of permutation. The S-box ensures the confusion of the algorithm. Random number exclusive OR in key orchestration reduces the linear dependence of the algorithm by increasing the complexity of the key orchestration. Because the whole encryption process adopts the FRX structure, the decryption process can use the same structure with encryption, and the only difference is that subkeys in the encryption process are used in reverse order and in reverse order in the decryption process.
And (3) testing:
the method provided by the embodiment of the invention is tested, wherein the cryptographic algorithm data provided by the invention are shown in table 7.
Table 7 experimental test data
When the cryptographic algorithm is implemented by Xilinx Virtex-5 FPGA hardware, the clock period of the algorithm is 2.894ns, the clock frequency is 424.493MHz, and the throughput rate is 400Kbps.
When the cryptographic algorithm is implemented by ASIC hardware, the comprehensive process library is SMIC 0.18. The area of resources occupied by the algorithm is 1983GE. Wherein, table 8 is a typical block cipher algorithm FPGA hardware implementation of the minimum key length, and table 9 is a typical block cipher algorithm ASIC hardware implementation of the minimum key length.
Table 8 each block cipher algorithm FPGA implementation
Algorithm Structure of the Packet length (bits) Key length (bits) Throughput rate (Kbps)
TEA Feistel 64 128 400
PRESNET-128 SPN 64 128 200
LED-128 SPN 64 128 133.33
XTEA Feistel 64 128 200
KASUMI(D) GFN 64 128 115.14
HIGHT GFN 64 128 188
HFSP FRX 64 128 400
Table 9 block cipher algorithm ASIC implementations
Algorithm Structure of the Packet length (bits) Key length (bits) Resource area (GE)
SKINNY-64-128 SPN 64 128 1696
PRESNET-64-80 SPN 64 128 1884
SIMON-64-128 Feistel 64 128 1751
PICCOLO-64-128 GFN 64 128 1773
mCrypton-64-128 SPN 64 128 2949
HIGHT GFN 64 128 3048
LED-64-128 SPN 64 128 3036
HFSP FRX 64 128 1983
Comparison of the data in table 8 and table 9 shows that HFSP has higher performance in terms of frequency and throughput rate under the condition of small difference of occupied area resources compared with the current block cipher.
It should be emphasized that the examples described herein are illustrative rather than limiting, and that this invention is not limited to the examples described in the specific embodiments, but is capable of other embodiments in accordance with the teachings of the present invention, as long as they do not depart from the spirit and scope of the invention, whether modified or substituted, and still fall within the scope of the invention.

Claims (9)

1. The encryption realization method of the novel dynamic block cipher HFSP with consistent encryption and decryption is characterized by comprising the following steps:
setting a 128-bit Key and performing shift operation to obtain k a
Step two, according to the number of current iteration rounds, for k a Performing two different split operations; wherein the first minute wheel operation is: will k a S box replacement is carried out to obtain 128-bit data ks, and then P replacement is carried out on the ks to obtain keys;
the second type of minute wheel operation is: will k a S box replacement is carried out to obtain 128-bit data ks, and two different sub-sub operations are carried out according to whether the number of the current iteration is larger than a preset value or not: when not greater than the preset value the sub-division operation of (2) is as follows: performing exclusive OR on ks and the number of the current iteration round number to obtain kx; when the value is larger than the preset value the sub-division operation of (2) is as follows: performing exclusive or on ks and the generated number X to obtain kx; finally P replacement is carried out on kx to obtain a key;
then save the key and take the key as k a The key is used for the next iteration and then used as the key used in the iteration of the round;
sequentially executing FRX structure transformation including high round key exclusive OR, first round cyclic shift, first round constant exclusive OR, F function, second round constant exclusive OR, second round cyclic shift and low round key exclusive OR on 64-bit plaintext to be encrypted based on key, and taking the obtained result as the plaintext to be encrypted in the next round of iteration; wherein the F function includes an initial permutation, an S-box substitution, and an initial inverse permutation performed in sequence;
checking the current iteration times, and returning to the second step for iteration if the current iteration times do not reach the preset iteration times; and otherwise, outputting the result of the step three as encrypted ciphertext.
2. The encryption implementation method according to claim 1, wherein in the first step, the shifting operation includes the steps of:
the 128-bit key is divided into 16 8-bit bytes and sequentially arranged to form a 4×4 matrix, and then the 1 st row and the 3 rd row of the matrix are interchanged, and the 2 nd row and the 4 th row are interchanged.
3. The encryption implementation method according to claim 1, wherein in the second step, the round operation is performed according to the number of rounds of the current iteration, the number of rounds of iteration is set to a plurality of rounds of iteration starting from round 0, the first round operation is performed when the number of rounds of iteration is a composite number, the second round operation is performed when the number of rounds of iteration is a prime number, and the first round operation is performed for each of round 0 and round 1.
4. The encryption implementation method according to claim 1, wherein in the second and third steps, S-box replacement includes:
the S box replacement is completed by adopting logic operation or table lookup, wherein the operation formula of the logic operation is as follows:
wherein a, b, c and d respectively represent 4 bits from high order to low order of the 4-bit binary number, a ', b', c 'and d' are obtained through transformation, and are recombined into the 4-bit binary number, and the range of binary number converted into decimal number is 0-15;
the table lookup is performed according to a preset S-box substitution table, wherein the S-box substitution table is obtained based on the result of the logic operation.
5. The encryption implementation method according to claim 1, wherein in the second step, P permutation is performed on 128 bits of data using a permutation operation with each bit as a unit, and the permutation is performed according to a predetermined P permutation table.
6. The encryption realization method according to claim 1, wherein in the second step, the generation number X is obtained by:
where RD represents the number of rounds of the current iteration and mod represents the remainder operation.
7. The encryption implementation method according to claim 1, wherein the third step is:
first, the key takes the upper 64 bits as the key left branch K 0 The lower 64 bits are the key right branch K 1 The method comprises the steps of carrying out a first treatment on the surface of the And takes the 64-bit plaintext to be encrypted as the left branch P of the plaintext by using the upper 32 bits 0 The lower 32 bits are taken as the right branch P 1
Then branch left plaintext P 0 Left branch of AND key K 0 Exclusive OR is performed on the upper 32 bits of the L-bit block to obtain Lp 1 At the same time branch the plaintext right P 1 Left branch of AND key K 0 Exclusive or is performed on the upper 32 bits of (2) to obtain Rp 1 Thereby completing the high round key exclusive OR;
and then Lp 1 Circularly shifting left by 9 bits to obtain Ls 1 Right branch Rp 1 Right shift by 9 bits circularly to obtain Rs 1 Thereby completing the first cyclic shift;
executing the first round constant exclusive OR, setting the iteration round number to be from the 0 th round, and when the current iteration round number is odd, ls 1 Constant r of the wheel 3 Performing exclusive OR to obtain Lp 2 ,Rs 1 Constant r of the wheel 4 Performing exclusive OR to obtain Rp 2 The method comprises the steps of carrying out a first treatment on the surface of the When the number of rounds of the current iteration is even, ls 1 Constant r of the wheel 1 Performing exclusive OR to obtain Lp 2 ,Rs 1 Constant r of the wheel 2 Performing exclusive OR to obtain Rp 2 The method comprises the steps of carrying out a first treatment on the surface of the Wherein the wheel constant is a preset value;
and then to Lp 2 Performing an F function including initial permutation, S-box permutation, and initial inverse permutation to obtain Lp 3 ,Rp 2 Also perform F functionTo Rp 3
Executing the constant exclusive OR of the second round, setting the iteration round number to be from the 0 th round, and when the round number of the current iteration is odd, lp 3 Constant r of the wheel 3 Performing exclusive OR to obtain Lp 4 ,Rp 3 Constant r of the wheel 4 Performing exclusive OR to obtain Rp 4 The method comprises the steps of carrying out a first treatment on the surface of the When the number of the current iteration turns is even, lp 3 Constant r of the wheel 1 Performing exclusive OR to obtain Lp 4 ,Rp 3 Constant r of the wheel 2 Performing exclusive OR to obtain Rp 4 The method comprises the steps of carrying out a first treatment on the surface of the Wherein the wheel constant is a preset value;
and then to Lp 4 Performing circular right shift for 9 bits to obtain Ls 2 ,Rp 4 Circularly shifting left by 9 bits to obtain Rs 2 Thereby completing the second cyclic shift;
finally Ls is added 2 Right branch of AND key K 1 Exclusive OR is performed on the upper 32 bits of the L-bit block to obtain Lp 5 Rs will be 2 Right branch of AND key K 1 Exclusive or is performed on the upper 32 bits of (2) to obtain Rp 5
The Lp obtained was then used 5 And Rp 5 As P in the next round of iteration 0 And P 1 And (3) finishing the step three.
8. The encryption implementation method according to claim 7, wherein the F-functions including initial permutation, S-box substitution, and initial inverse permutation are:
initial replacement: using initial substitution table, lp in class DES algorithm 2 Completion of the diffusion operation by querying the initial substitution table to obtain Lp 2 ' Rp is taken as 2 Completing diffusion operation by querying initial substitution table to obtain Rp 2 ′;
S box replacement: by adopting a S-box replacement mode of logic operation or table lookup, the result Lp obtained by the initial replacement operation is obtained 2 ' and Rp 2 ' transform separately;
initial reverse substitution: an initial reverse substitution table in the class-DES algorithm is adopted to complete Lp of S-box substitution operation 2 ' and Rp 2 ' query initial reverse substitution table to complete diffusion operation to obtain Lp 3 And Rp 3
9. The decryption implementation method of the novel dynamic block cipher HFSP with consistent encryption and decryption is characterized in that encrypted ciphertext output by the encryption implementation method of any one of claims 1-8 is taken as a decryption object, step three in the encryption implementation method of any one of claims 1-8 is iteratively executed on the ciphertext, the number of iteration rounds is the same as that of the encryption implementation method of any one of claims 1-8, but the number of rounds in the iteration process is counted from back to front, and keys corresponding to the number of rounds are used in a front-back reversal mode to decrypt.
CN202310437143.8A 2023-04-21 2023-04-21 Encryption and decryption realization method of novel dynamic block cipher HFSP with consistent encryption and decryption Pending CN116743352A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202310437143.8A CN116743352A (en) 2023-04-21 2023-04-21 Encryption and decryption realization method of novel dynamic block cipher HFSP with consistent encryption and decryption

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202310437143.8A CN116743352A (en) 2023-04-21 2023-04-21 Encryption and decryption realization method of novel dynamic block cipher HFSP with consistent encryption and decryption

Publications (1)

Publication Number Publication Date
CN116743352A true CN116743352A (en) 2023-09-12

Family

ID=87908702

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202310437143.8A Pending CN116743352A (en) 2023-04-21 2023-04-21 Encryption and decryption realization method of novel dynamic block cipher HFSP with consistent encryption and decryption

Country Status (1)

Country Link
CN (1) CN116743352A (en)

Similar Documents

Publication Publication Date Title
KR100389902B1 (en) Fast block encryption method guaranteeing security for differential cryptanalysis and linear cryptanalysis
US6199162B1 (en) Block cipher method
US5745577A (en) Symmetric cryptographic system for data encryption
US7092525B2 (en) Cryptographic system with enhanced encryption function and cipher key for data encryption standard
CN107147487B (en) Symmetric key random block cipher
CN107707343B (en) SP network structure lightweight block cipher realization method with consistent encryption and decryption
CN109768854B (en) Method for realizing lightweight block cipher algorithm
WO2012132623A1 (en) Encryption processing device, encryption processing method, and programme
CN110572255B (en) Encryption method and device based on lightweight block cipher algorithm Shadow and computer readable medium
Grosso et al. SCREAM & iSCREAM side-channel resistant authenticated encryption with masking
CN111431697A (en) Novel method for realizing lightweight block cipher COR L
KR20050078271A (en) Hardware cryptographic engine and method improving power consumption and operation speed
Achkoun et al. SPF-CA: A new cellular automata based block cipher using key-dependent S-boxes
Lu Cryptanalysis of block ciphers
CN113691364B (en) Encryption and decryption method of dynamic S-box block cipher based on bit slice technology
WO1999014889A1 (en) Improved block cipher method
Moldovyan On cipher design based on switchable controlled operations
Shimal et al. Extended of TEA: A 256 bits block cipher algorithm for image encryption
CN116743352A (en) Encryption and decryption realization method of novel dynamic block cipher HFSP with consistent encryption and decryption
CN110247754B (en) Method and device for realizing block cipher FBC
Al-Rahman et al. A hybrid lightweight cipher algorithm
Polimón et al. Automated design of a lightweight block cipher with genetic programming
Kothandan Modified Blowfish Algorithm to Enhance its Performance and Security
Abd Al-Rahman et al. A Hybrid Lightweight Cipher Algorithm
CN110943825B (en) Perfect security block cipher

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination