Serial pipeline type Simon encryption and decryption system and method

By designing a serial streaming Simon encryption and decryption system, using multiple-wheel serial streaming circuit structure and configuration coordinator, the Simon encryption algorithm has solved the problem of slow encryption speed and large resource utilization in the Internet of Things field, and achieved efficient addition Decryption function and hybrid data processing.

CN119109572APending Publication Date: 2024-12-10NANTONG UNIV
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411128408.7
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-08-16
Publication Date
2024-12-10

AI Technical Summary

Technical Problem

The existing Simon encryption algorithms are slow to encrypt, have large resources, and are difficult to support encryption and decryption functions in the field of the Internet of Things, and cannot meet the needs of diverse application scenarios.

Method used

Design a serial streaming Simon encryption and decryption system, adopting a multi-wheel serial streaming circuit structure, including top-level module, serial port receiving module, serial port sending module and multiple encryption and decryption modules, and realizes by configuring the coordinator and key scheduling module. Encryption and decryption operations, support mixed data processing.

Benefits of technology

It significantly improves the calculation speed of encryption or decryption results, supports the hybrid processing of encryption and decryption functions, and reduces resource consumption. The data inputted by the circuit can be encrypted and decrypted mixed data, and the encryption and encryption of a large number of plain text and cipher text within a certain period of time is completed. Decryption processing.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119109572A_ABST
    Figure CN119109572A_ABST
Patent Text Reader

Abstract

The invention discloses a serial pipeline type Simon encryption and decryption system and method. The system designed by the invention comprises a top layer module, a serial port receiving module, a serial port sending module and a plurality of encryption and decryption modules, the encryption and decryption module comprises a key scheduling module, a round function operation module, a shift module and a temporary memory; the top layer module integrates the serial port receiving module, the serial port sending module and the encryption and decryption module, and needs to execute encryption and decryption functions according to serial port input of a user and output a corresponding result to the user through a serial port; the method designed by the invention is based on a serial pipeline type Simon encryption and decryption system, adopts a Simon encryption and decryption algorithm, and respectively performs key scheduling and round function operation based on a key scheduling module and a round function operation module to complete the encryption or decryption process of data; according to the method, encryption or decryption operation of a large amount of data can be supported, the calculation speed of an encryption or decryption result is remarkably improved, and encryption and decryption data hybrid processing is supported.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of information security, and in particular to a serial pipeline Simon encryption and decryption system, and also to a serial pipeline Simon encryption and decryption method. Background Art

[0002] With the development of IoT technology, the application of encryption algorithms in the IoT field has focused on security while also increasing the requirements for encryption efficiency and flexibility. Traditional encryption algorithms such as AES and ECC have high security, but they occupy a large amount of resources and have low execution efficiency. The limited number of mode options makes them lack flexibility and it is difficult to meet encryption requirements in various IoT application scenarios.

[0003] As a lightweight block cipher algorithm, the Simon algorithm has low hardware complexity and resource consumption, and is suitable for resource-constrained environments. However, the existing Simon algorithm hardware implementation has problems such as slow speed and high resource consumption.

[0004] The existing multi-configuration mode SIMON algorithm encryption circuit includes a data flow control unit, a round constant switching unit, a secret key expansion unit and a round function operation unit. The data flow control unit is connected to the input ends of the round constant switching unit, the secret key expansion unit and the round function operation unit, and another output end of the data flow control unit is used to output an encryption completion signal; the output end of the round constant switching unit is connected to the input end of the secret key expansion unit; the output end of the secret key expansion unit is connected to the input end of the round function operation unit, and a set of round secret keys is output to the round function operation unit in each clock cycle; the round function operation unit performs a round operation in the corresponding configuration mode until the data flow control unit outputs an encryption completion signal and outputs a ciphertext. The advantages of the multi-configuration mode SIMON algorithm encryption circuit are: simple structure, multiple configuration modes, small chip size, which is conducive to its wide use in Internet of Things scenarios. However, the encryption speed is too slow and cannot simultaneously support the decryption function of encrypted data. Summary of the invention

[0005] The purpose of the present invention is to provide a serial pipeline Simon encryption and decryption system and method. Based on the principle of the Simon encryption algorithm, a multi-round serial pipeline Simon encryption and decryption circuit structure is designed, which can support encryption or decryption operations on a large amount of data, significantly improve the calculation speed of encryption or decryption results, and support mixed processing of encryption and decryption data.

[0006] To achieve the above functions, the present invention designs a serial flow Simon encryption and decryption system, including: a top-level module, a serial port receiving module, a serial port sending module, and multiple encryption and decryption modules; the levels of each module are divided as follows:

[0007] The top-level module is the highest-level module, which contains a serial port receiving module, a serial port sending module, an encryption and decryption module, an external clock source, and a configuration coordinator; the output end of the serial port receiving module and the input end of the serial port sending module are respectively connected to the input end and the output end of the configuration coordinator; the data input by the user, including the plaintext key to be encrypted or the ciphertext key to be decrypted, is input to the configuration coordinator through the serial port receiving module, and after encryption or decryption, the corresponding result is output to the user through the serial port sending module;

[0008] Multiple encryption and decryption modules are connected in sequence, corresponding to multiple rounds of encryption or decryption processes respectively. The input end of the configuration coordinator inside the top-level module is connected to the output end of the encryption and decryption module of the final round; the output end of the configuration coordinator is connected to the input end of the encryption and decryption module of the first round.

[0009] As a preferred technical solution of the present invention: the input end of the first round of encryption and decryption modules is connected to the output end of the configuration coordinator inside the top-level module, and is responsible for transmitting the plaintext key or ciphertext key required for the first round of encryption or decryption; the input end of the middle round of encryption and decryption modules is connected to the output end of the previous round of encryption and decryption modules, and the output end is connected to the input end of the next round of encryption and decryption modules; the output end of the last round of encryption and decryption modules is connected to the input end of the configuration coordinator inside the top-level module, and is responsible for transmitting the encryption or decryption results.

[0010] As a preferred technical solution of the present invention: the serial port receiving module receives the data input by the user bit by bit, and caches it each time it receives one bit of data. At the same time, it determines the state of the current input data, and performs data verification after receiving it. If the preset verification conditions are not met, a failure signal is issued. If the preset verification conditions are met, the reception is successful and a signal to be taken out is issued.

[0011] As a preferred technical solution of the present invention: the serial port sending module puts the encrypted or decrypted result into the sending buffer before sending it, calculates the check bit, and then outputs the encrypted or decrypted result to be sent bit by bit. If the sending is completed, a transmission completion signal is issued.

[0012] As a preferred technical solution of the present invention: the encryption and decryption module includes a key scheduling module, a round function operation module, a shift module, and also includes a temporary register;

[0013] Among them, the input end and output end of the shift module are respectively connected to the round function operation module and the key scheduling module, the output end of the key scheduling module is connected to the input end of the round function operation module, and the output end of the register is connected to the input end of the round function operation module; the output end of the configuration coordinator inside the top-level module is respectively connected to the input end of the key scheduling module and the input end of the register in the first round of encryption and decryption modules; in the encryption and decryption modules of the middle rounds, the output end of the key scheduling module and the output end of the round function operation module are respectively connected to the input end of the key scheduling module and the input end of the register in the encryption and decryption modules of the next round; in the encryption and decryption modules of the last round, the output end of the key scheduling module and the output end of the round function operation module are respectively connected to the input end of the configuration coordinator inside the top-level module;

[0014] The key scheduling module performs key generation operations according to the Simon encryption algorithm, and the round function operation module performs a round of encryption or decryption operations; the shift module is used to implement the cyclic shift operations of the key scheduling module and the round function operation module; the temporary register is used to temporarily store each round of encrypted or decrypted data.

[0015] As a preferred technical solution of the present invention: during the first m rounds of encryption or decryption, the key is initialized directly from the master key, and the key scheduling module generates the remaining (Tm) rounds of keys, where T is the total number of rounds, and the key scheduling module is called once for each round of key generation.

[0016] The present invention also designs a serial flow Simon encryption and decryption method. Based on the serial flow Simon encryption and decryption system, the following steps S1 to S6 are executed to complete the encryption or decryption process of data:

[0017] Step S1: Obtain the input plaintext key to be encrypted or the ciphertext key to be decrypted, analyze the mode selection information, and set the system working mode to the corresponding Simon encryption or decryption mode;

[0018] Step S2: Execute the data processing flow in this mode, integrate the data input by the user into the plaintext key pair or ciphertext key pair required by the encryption and decryption module and transmit it to the encryption and decryption module;

[0019] Step S3: the encryption / decryption module executes the corresponding Simon encryption or decryption mode according to the mode selection information, and performs a round of encryption or decryption;

[0020] Step S4: The ciphertext obtained by the current round of encryption or the plaintext obtained by the current round of decryption is stored in a temporary memory, and the number of encryption or decryption rounds is calculated;

[0021] Step S5: Determine whether the number of encryption or decryption rounds meets the preset requirements; if not, return to step S2; if satisfied, prepare the required plaintext key or ciphertext key for subsequent encryption or decryption rounds, and execute step S6;

[0022] Step S6: The configuration coordinator obtains the encrypted ciphertext or the decrypted plaintext from the encryption and decryption module, and sends it to the user through the serial port sending module.

[0023] As a preferred technical solution of the present invention, the steps of performing one round of encryption or decryption by the encryption / decryption module are as follows:

[0024] Step S3.1: Calculate the current encryption or decryption round;

[0025] Step S3.2: The encryption and decryption module uses the Simon encryption algorithm, and performs key scheduling and round function operation based on the key scheduling module and the round function operation module; the Simon encryption algorithm is as follows:

[0026] Simon 2n / mn

[0027] Where n is the encryption word length, m is the number of key words, 2n is the packet length, and mn is the key length; n is 16, 24, 32, 48, or 64; m is 2, 3, or 4;

[0028] Step S3.3: The encryption / decryption module outputs the ciphertext obtained by encryption or the plaintext obtained by decryption.

[0029] As a preferred technical solution of the present invention: the key scheduling performed by the key scheduling module is as follows:

[0030]

[0031] In the formula, if y is positive, S y (x) means x is shifted y times to the left. If y is a negative value, S y (x) means x is shifted right y times; the subscript i+m indicates the number of rounds currently executed, and m is the number of key words.

[0032] As a preferred technical solution of the present invention: the round function operation performed by the round function operation module is as follows:

[0033]

[0034] In the formula, if y is positive, S y (x) means x is shifted y times to the left. If y is a negative value, S y (x) means x is circularly shifted to the right y times, and m is the number of key words.

[0035] Beneficial effects: Compared with the prior art, the advantages of the present invention include:

[0036] 1. Supporting two functions of encryption and decryption; based on the principle of Simon encryption algorithm, the present invention realizes encryption and decryption circuits respectively and deeply integrates the two circuits. On the one hand, it greatly reduces the overall resource consumption of encryption and decryption circuits, and on the other hand, it realizes the hybrid processing of encryption and decryption functions, that is, the data input to the circuit can be a mixed data of encryption and decryption, and the circuit will perform corresponding operations and output according to the encryption and decryption mode input.

[0037] 2. Fast encryption and decryption processing speed; the serial pipeline circuit structure of the present invention can complete the encryption and decryption processing of a large amount of plaintext and ciphertext in a certain period of time, which is 40 times the amount of data that can be processed by the non-serial pipeline structure; due to the use of hardware to implement the algorithm, the time consumption of a single round of encryption in the serial pipeline circuit structure of the present invention is much lower than the method implemented by C language software. BRIEF DESCRIPTION OF THE DRAWINGS

[0038] Figure 1 It is a schematic diagram of collaborative design of a serial pipeline Simon encryption and decryption system provided according to an embodiment of the present invention;

[0039] Figure 2 It is a comparison diagram of the encryption process of the serial pipeline structure and the non-serial pipeline structure provided according to the embodiment of the present invention;

[0040] Figure 3 It is a bar chart comparing specific FPGA resource usage before and after the encryption and decryption integration and the use of the serial port provided by an embodiment of the present invention;

[0041] Figure 4 is a bar chart comparing the overall FPGA resource usage before and after the encryption and decryption integration and the use of the serial port provided by an embodiment of the present invention;

[0042] Figure 5 is a flowchart of the encryption and decryption module function execution according to an embodiment of the present invention;

[0043] Figure 6 It is a comparison chart of encryption execution effects of C language implementation, non-serial pipeline structure, and serial pipeline structure provided according to an embodiment of the present invention. DETAILED DESCRIPTION

[0044] The present invention will be further described below in conjunction with the accompanying drawings. The following embodiments are only used to more clearly illustrate the technical solution of the present invention, and cannot be used to limit the protection scope of the present invention.

[0045] A serial flow Simon encryption and decryption system provided by an embodiment of the present invention refers to Figure 1, including: top-level module, serial port receiving module, serial port sending module, and multiple encryption and decryption modules; the levels of each module are divided as follows:

[0046] The top-level module is the highest-level module, which contains a serial port receiving module, a serial port sending module, an encryption and decryption module, an external clock source, and a configuration coordinator; the output end of the serial port receiving module and the input end of the serial port sending module are respectively connected to the input end and the output end of the configuration coordinator; the data input by the user, including the plaintext key to be encrypted or the ciphertext key to be decrypted, is input to the configuration coordinator through the serial port receiving module, and after encryption or decryption, the corresponding result is output to the user through the serial port sending module;

[0047] The top-level module instantiates the serial port receiving module and the serial port sending module to realize serial port communication with the host computer. According to the data received by the serial port, the encryption or decryption module is called to realize the data encryption or decryption function, and then the encryption or decryption result is output to the host computer through the serial port.

[0048] The serial port receiving module receives the data input by the user bit by bit. Each time a bit of data is received, it must be cached and the status of the current input data must be determined. After receiving the data, a data check is performed. If the preset check conditions are not met, a failure signal is issued. If the preset check conditions are met, the reception is successful and a waiting signal is issued.

[0049] The serial port sending module puts the encrypted or decrypted result into the sending buffer before sending it, calculates the check bit, and then outputs the encrypted or decrypted result to be sent bit by bit. If the sending is completed, a transmission completion signal is issued.

[0050] Multiple encryption and decryption modules are connected in sequence, corresponding to multiple rounds of encryption or decryption processes respectively. The input end of the configuration coordinator inside the top-level module is connected to the output end of the encryption and decryption module of the final round; the output end of the configuration coordinator is connected to the input end of the encryption and decryption module of the first round.

[0051] The input end of the first round of encryption and decryption modules is connected to the output end of the configuration coordinator inside the top-level module, and is responsible for transmitting the plaintext key or ciphertext key required for the first round of encryption or decryption; the input end of the middle round of encryption and decryption modules is connected to the output end of the previous round of encryption and decryption modules, and the output end is connected to the input end of the next round of encryption and decryption modules; the output end of the last round of encryption and decryption modules is connected to the input end of the configuration coordinator inside the top-level module, and is responsible for transmitting the encryption or decryption results.

[0052] The encryption and decryption module includes a key scheduling module, a round function operation module, a shift module, and a temporary register; the key scheduling module performs a key generation operation according to the Simon encryption algorithm, and the round function operation module performs a round of encryption or decryption operation; the shift module is used to implement the cyclic shift operation of the key scheduling module and the round function operation module; the temporary register is used to temporarily store each round of encrypted or decrypted data.

[0053] According to the number of rounds and mode selection, the operation process of the encryption and decryption module includes the execution of multiple rounds of key scheduling and round function operations, and the structure is similar to a serial adder.

[0054] The encryption and decryption module is responsible for implementing the encryption and decryption functions. It needs to instantiate the key scheduling module and the round function operation module multiple times according to the number of encryption rounds. Among them, the key scheduling module performs the key generation operation according to the requirements of the Simon encryption algorithm, and the round function operation module performs a round of encryption operation according to the plaintext and the generated key segment. The circular shift operation repeatedly used by the key scheduling module and the round function operation module is realized by instantiating the shift module. The mutual cooperation and layered calling of these modules provide users with an efficient and secure Simon encryption circuit.

[0055] The key scheduling module and the round function operation module will frequently involve related operations of circular shift, including circular left shift and circular right shift. Therefore, it is necessary to design a separate module specifically for shift operations, which can effectively reduce the coupling of various modules in the circuit and improve the stability and maintainability of the circuit.

[0056] The input and output of the shift module are respectively connected to the round function operation module and the key scheduling module, the output of the key scheduling module is connected to the input of the round function operation module, and the output of the register is connected to the input of the round function operation module; the output of the configuration coordinator inside the top-level module is respectively connected to the input of the key scheduling module and the input of the register in the first round of encryption and decryption modules; in the encryption and decryption modules of the middle rounds, the output of the key scheduling module and the output of the round function operation module are respectively connected to the input of the key scheduling module and the input of the register in the encryption and decryption modules of the next round; in the encryption and decryption modules of the last round, the output of the key scheduling module and the output of the round function operation module are respectively connected to the input of the configuration coordinator inside the top-level module;

[0057] like Figure 2As shown in the figure, the encryption and decryption module adopts a serial pipeline structure to support the parallel encryption and decryption of multiple data; based on the Feistel structure characteristics of the Simon encryption algorithm, the encryption and decryption functions are deeply integrated, which greatly reduces the resource occupation of the encryption and decryption functions. The specific workflow is: accumulate encryption rounds, output the results when the number of encryptions meets the requirements of the current mode, and prepare the ciphertext and key required for subsequent encryption rounds, ensuring that the round function operation module and the key scheduling module can be connected to promote the encryption process.

[0058] The present invention utilizes the fact that the validity period of the intermediate result is only one round, and reasonably sets the size of the encryption and decryption module register to store the necessary encryption results. After each round of encryption is completed, the result of that round is stored in the higher bits of the register, realizing a pipeline structure similar to a serial adder, which can allow multiple data to be encrypted and decrypted in parallel, greatly improving the encryption speed. Similar circuit structures are also applicable to decryption functions. The problems solved by the serial pipeline structure and the specific implementation are as follows:

[0059] 1. Problem to be solved: Simon encryption circuit needs to perform multiple rounds of encryption operations. The module includes 32 submodules consisting of round functions, shifts, and key scheduling. Each submodule completes a round of encryption tasks and the generated results are sent to the next round. If the set register can only store the results of a single round of encryption, then after completing the encryption of the plaintext once, it is necessary to wait for several rounds again to get the result of the next encryption, that is, multiple data. In this way, a lot of time will be wasted on covering the encrypted intermediate values ​​during large-scale encryption, which is inefficient.

[0060] 2. Specific implementation: Taking advantage of the fact that the validity period of the intermediate result is only one round, the value is discarded when the interval reaches two rounds. Set the register size to be able to store the encryption results of all rounds or set a register for each round to store the results of the round. After each round of encryption is completed, the result of the round is stored in the higher bit of the register. Then, when the next round of encryption is performed, the submodule responsible for each round of operation can directly perform the corresponding round of operation of the next plaintext after completing a round of operation, thereby realizing a pipeline structure similar to a serial adder. The number of segments of the pipeline structure is determined by the number of rounds required for encryption. Taking Simon32 / 64 as an example, 32 rounds of encryption operations are required. Each round of encryption operation includes key scheduling and round function operation. Each round is regarded as a segment. After each round of encryption execution, the temporary data is stored and handed over to the next round (segment) for use. When the next round (segment) calculation is completed, the calculation of this round is also completed, so the temporarily stored data is invalid and can be replaced with the new data obtained by calculation. In this way, the key scheduling and round function operation of 32 segments can be executed simultaneously, thereby obtaining the best operating efficiency.

[0061] The specific FPGA resource usage before and after encryption and decryption integration and serial port use is compared in the bar chart for reference Figure 3 , the overall FPGA resource usage before and after encryption and decryption integration and using the serial port is compared in the bar chart. Figure 4 .

[0062] The integration of encryption and decryption modes is mainly based on the formula of Simon encryption algorithm to select the circuit corresponding encryption or decryption branch structure, and is implemented by gate circuits. The integration of the present invention enables the circuit to support the processing of encryption and decryption mixed data input.

[0063] The key scheduling module is composed of a shift module and several logic gate circuits.

[0064] The key scheduling module generates the key for the next round of encryption. For a specific Simon 2n / mn, the key scheduling method depends on the value of m. During the first m rounds of encryption or decryption, the key is initialized directly from the master key. The key scheduling module generates the remaining (Tm) rounds of keys, where T is the total number of rounds. The key scheduling module is called once for each round of key generation, and the corresponding shift operation is completed by the shift module.

[0065] The round function operation module is composed of a shift module and several logic gate circuits.

[0066] The round function operation module implements a round function operation defined by the Simon encryption algorithm, that is, performs encryption operation processing according to the key segment generated by the key scheduling, the existing ciphertext state information and the number of bits specified by the round constant. The corresponding shift operation is completed by the shift module.

[0067] The shift module is composed of several logic gate circuits.

[0068] The shift module shifts the input data left or right according to the input shift amount and direction control bit, and outputs the result according to a certain algorithm process.

[0069] The serial port sending module and the serial port receiving module execute the serial port communication protocol to realize the communication between the encryption and decryption circuit and the host computer.

[0070] The embodiment of the present invention further provides a serial pipeline Simon encryption and decryption method. Based on the serial pipeline Simon encryption and decryption system, the following steps S1 to S6 are executed to complete the data encryption or decryption process:

[0071] Step S1: Obtain the input plaintext key to be encrypted or the ciphertext key to be decrypted, analyze the mode selection information, and set the system working mode to the corresponding Simon encryption or decryption mode;

[0072] Step S2: Execute the data processing flow in this mode, integrate the data input by the user into the plaintext key pair or ciphertext key pair required by the encryption and decryption module and transmit it to the encryption and decryption module;

[0073] Step S3: the encryption / decryption module executes the corresponding Simon encryption or decryption mode according to the mode selection information, and performs a round of encryption or decryption;

[0074] Refer to the encryption and decryption module function execution flow chart Figure 5 , the left side is the overall encryption process, the right side is the single-round encryption process, and the decryption function is executed in a similar structure; the steps for the encryption or decryption module to perform a round of encryption or decryption are as follows:

[0075] Step S3.1: Calculate the current encryption or decryption round;

[0076] Step S3.2: The encryption and decryption module uses the Simon encryption algorithm. As a lightweight block encryption algorithm, the Simon encryption algorithm uses a Feistel structure and has 10 parameter configurations for different encryption requirements, as shown in Table 1 below:

[0077] Table 1

[0078]

[0079] Based on the key scheduling module and the round function operation module, key scheduling and round function operation are performed respectively; the Simon encryption algorithm is as follows:

[0080] Simon 2n / mn

[0081] Where n is the encryption word length, m is the number of key words, 2n is the packet length, and mn is the key length; n is 16, 24, 32, 48, or 64; m is 2, 3, or 4; for each combination of m and n, the corresponding number of rounds T needs to be used;

[0082] Step S3.3: The encryption / decryption module outputs the ciphertext obtained by encryption or the plaintext obtained by decryption.

[0083] In the specific Simon encryption algorithm execution process, the two steps of round function operation and key scheduling operation will be iteratively executed according to the number of rounds, mainly involving XOR, shift, and AND operations;

[0084] The key scheduling method depends on the value of m. The key scheduling performed by the key scheduling module is as follows:

[0085]

[0086] In the formula, if y is positive, S y(x) means x is shifted y times to the left. If y is a negative value, S y (x) indicates that x is circularly shifted to the right y times; the corresponding shift operation is completed by the shift module; the subscript i+m indicates the number of rounds currently executed, and m is the number of key words.

[0087] The round function operation module needs to implement a round function operation defined by the Simon encryption algorithm, that is, to perform encryption operation processing according to the key segment generated by the key scheduling, the existing ciphertext state information and the number of bits specified by the round constant; the round function operation performed by the round function operation module is as follows:

[0088]

[0089] In the formula, if y is positive, S y (x) means x is shifted y times to the left. If y is a negative value, S y (x) means x is circularly shifted right y times; m is the number of key words, and the corresponding shift operation is completed by the shift module.

[0090] In one embodiment, the Simon encryption algorithm is Simon32 / 64, that is, Simon2*16 / 4*16, that is, n=16, m=4; according to Table 1, the number of rounds T=32, indicating that 32 rounds of encryption operations are required, and each encryption operation includes one key scheduling and one round function operation, where:

[0091] (1) Key scheduling: Since m = 4, we choose:

[0092]

[0093] There are three shift functions S in the formula y (x), so the shift module needs to be called three times;

[0094] If other Simon encryption modes are selected, such as Simon96 / 96, m=2, then:

[0095]

[0096] There are two shift functions S y (x), so the shift module needs to be called twice;

[0097] (2) Round function operation: Since the Simon encryption algorithm Simon32 / 64 has three shift functions S y (x), so the shift module needs to be called three times, regardless of the value of m;

[0098] Step S4: The ciphertext obtained by the current round of encryption or the plaintext obtained by the current round of decryption is stored in a temporary memory, and the number of encryption or decryption rounds is calculated;

[0099] Step S5: Determine whether the number of encryption or decryption rounds meets the preset requirements; if not, return to step S2; if satisfied, prepare the required plaintext key or ciphertext key for the subsequent encryption or decryption rounds to ensure that the round function operation module and the key scheduling module can be connected to promote the encryption process to proceed smoothly; and execute step S6;

[0100] Step S6: The configuration coordinator obtains the encrypted ciphertext or the decrypted plaintext from the encryption and decryption module, and sends it to the user through the serial port sending module.

[0101] The following method is used to test the serial flow Simon encryption and decryption system and method designed by the present invention:

[0102] 1. Test of the amount of data encrypted and decrypted in a certain period of time: Use C++ to write a program, randomly generate 1000 plaintext key pairs as encryption input, write a simulation test file, and test how much data can be encrypted in a certain period of time. In order to complete as many encryption rounds as possible, it is necessary to set the simulation clock cycle appropriately. The final test results show that within a time range of 1000ns and a clock cycle of 2ns, the non-pipelined encryption and decryption circuit can complete 11 encryption and decryption operations, while the serial pipelined encryption and decryption circuit can complete 442 encryption and decryption operations, which is 40 times the amount of data that the non-serial pipeline structure can complete. It supports mixed encryption and decryption operations, and function switching does not occupy clock cycles.

[0103] 2. Single-round encryption time test for software and hardware: In order to clarify the time efficiency gap between software and hardware in implementing encryption algorithms, the fastest C language is selected to implement the Simon encryption algorithm in software. In order to avoid the impact of file reading operations on the total execution time, only one set of plaintext key pairs is encrypted, and the ciphertext key to be encrypted is assigned to the signal inside the program as an immediate value. The C program calls the clock() function of the time.h header file for execution timing. In order to eliminate the extra time cost caused by calling the header file, a program is written to execute the clock() function separately. The test shows that the time cost of executing the clock() function alone is less than 0.000 milliseconds, and the time cost of one round of encryption and decryption recorded by the clock() function reaches 0.002 milliseconds. Excluding the time cost of executing the clock() function alone, the Simon encryption algorithm implemented by the C program takes at least 0.001 milliseconds to perform one round of encryption. The time cost of encryption and decryption operations using the encryption hardware circuit designed by Verilog HDL mainly depends on the clock frequency. When the clock cycle is set to 2ns, the first round of encryption only takes 87ns, including the 21ns circuit reset delay that is not ignored.

[0104] C language implementation, non-serial pipeline structure, and serial pipeline structure encryption execution effect comparison chart reference Figure 6 The time consumption of a single round of encryption in the serial pipeline circuit structure of the present invention is much lower than that of the method implemented by C language software.

[0105] The embodiments of the present invention are described in detail above with reference to the accompanying drawings, but the present invention is not limited to the above embodiments, and various changes can be made within the knowledge scope of ordinary technicians in this field without departing from the purpose of the present invention.

Claims

1. A serial Simon encryption and decryption system, characterized in that: include: Top-level module, serial port receiving module, serial port sending module, and multiple encryption and decryption modules; the levels of each module are divided as follows: The top-level module is the highest-level module, which contains a serial port receiving module, a serial port sending module, an encryption and decryption module, an external clock source, and a configuration coordinator; the output end of the serial port receiving module and the input end of the serial port sending module are respectively connected to the input end and the output end of the configuration coordinator; the data input by the user, including the plaintext key to be encrypted or the ciphertext key to be decrypted, is input to the configuration coordinator through the serial port receiving module, and after encryption or decryption, the corresponding result is output to the user through the serial port sending module; Multiple encryption and decryption modules are connected in sequence, corresponding to multiple rounds of encryption or decryption processes respectively. The input end of the configuration coordinator inside the top-level module is connected to the output end of the encryption and decryption module of the final round; the output end of the configuration coordinator is connected to the input end of the encryption and decryption module of the first round.

2. A serial flow Simon encryption and decryption system according to claim 1, characterized in that: The input end of the first round of encryption and decryption modules is connected to the output end of the configuration coordinator inside the top-level module, and is responsible for transmitting the plaintext key or ciphertext key required for the first round of encryption or decryption; the input end of the middle round of encryption and decryption modules is connected to the output end of the previous round of encryption and decryption modules, and the output end is connected to the input end of the next round of encryption and decryption modules; the output end of the last round of encryption and decryption modules is connected to the input end of the configuration coordinator inside the top-level module, and is responsible for transmitting the encryption or decryption results.

3. A serial flow Simon encryption and decryption system according to claim 1, characterized in that: The serial port receiving module receives the data input by the user bit by bit. Each time a bit of data is received, it must be cached and the status of the current input data must be determined. After receiving the data, a data check is performed. If the preset check conditions are not met, a failure signal is issued. If the preset check conditions are met, the reception is successful and a waiting signal is issued.

4. A serial flow Simon encryption and decryption system according to claim 1, characterized in that: The serial port sending module puts the encrypted or decrypted result into the sending buffer before sending it, calculates the check bit, and then outputs the encrypted or decrypted result to be sent bit by bit. If the sending is completed, a transmission completion signal is issued.

5. The serial flow Simon encryption and decryption system according to claim 1, characterized in that: The encryption and decryption module includes a key scheduling module, a round function operation module, a shift module, and a temporary register; Among them, the input end and output end of the shift module are respectively connected to the round function operation module and the key scheduling module, the output end of the key scheduling module is connected to the input end of the round function operation module, and the output end of the register is connected to the input end of the round function operation module; the output end of the configuration coordinator inside the top-level module is respectively connected to the input end of the key scheduling module and the input end of the register in the first round of encryption and decryption modules; in the encryption and decryption modules of the middle rounds, the output end of the key scheduling module and the output end of the round function operation module are respectively connected to the input end of the key scheduling module and the input end of the register in the encryption and decryption modules of the next round; in the encryption and decryption modules of the last round, the output end of the key scheduling module and the output end of the round function operation module are respectively connected to the input end of the configuration coordinator inside the top-level module; The key scheduling module performs key generation operations according to the Simon encryption algorithm, and the round function operation module performs a round of encryption or decryption operations; the shift module is used to implement the cyclic shift operations of the key scheduling module and the round function operation module; the temporary register is used to temporarily store each round of encrypted or decrypted data.

6. A serial flow Simon encryption and decryption system according to claim 1, characterized in that: During the first m rounds of encryption or decryption, the key is initialized directly from the master key, and the key scheduling module generates the remaining (Tm) rounds of keys, where T is the total number of rounds, and the key scheduling module is called once for each round of key generation.

7. A serial Simon encryption and decryption method, characterized in that: Based on the serial pipeline Simon encryption and decryption system according to any one of claims 1 to 6, the following steps S1 to S6 are executed to complete the encryption or decryption process of the data: Step S1: Obtain the input plaintext key to be encrypted or the ciphertext key to be decrypted, analyze the mode selection information, and set the system working mode to the corresponding Simon encryption or decryption mode; Step S2: Execute the data processing flow in this mode, integrate the data input by the user into the plaintext key pair or ciphertext key pair required by the encryption and decryption module and transmit it to the encryption and decryption module; Step S3: the encryption / decryption module executes the corresponding Simon encryption or decryption mode according to the mode selection information, and performs a round of encryption or decryption; Step S4: The ciphertext obtained by the current round of encryption or the plaintext obtained by the current round of decryption is stored in a temporary memory, and the number of encryption or decryption rounds is calculated; Step S5: Determine whether the number of encryption or decryption rounds meets the preset requirements; if not, return to step S2; if satisfied, prepare the required plaintext key or ciphertext key for subsequent encryption or decryption rounds, and execute step S6; Step S6: The configuration coordinator obtains the encrypted ciphertext or the decrypted plaintext from the encryption and decryption module, and sends it to the user through the serial port sending module.

8. The serial flow Simon encryption and decryption method according to claim 7, characterized in that: The steps for the encryption and decryption module to perform a round of encryption or decryption are as follows: Step S3.1: Calculate the current encryption or decryption round; Step S3.2: The encryption and decryption module uses the Simon encryption algorithm, and performs key scheduling and round function operation based on the key scheduling module and the round function operation module; the Simon encryption algorithm is as follows: Simon 2n / mn Where n is the encryption word length, m is the number of key words, 2n is the packet length, and mn is the key length; n is 16, 24, 32, 48, or 64; m is 2, 3, or 4; Step S3.3: The encryption / decryption module outputs the ciphertext obtained by encryption or the plaintext obtained by decryption.

9. The serial flow Simon encryption and decryption method according to claim 8, characterized in that: The key scheduling performed by the key scheduling module is as follows: In the formula, if y is positive, S y (x) means x is shifted y times to the left. If y is a negative value, S y (x) means x is shifted right y times; the subscript i+m indicates the number of rounds currently executed, and m is the number of key words.

10. The serial flow Simon encryption and decryption method according to claim 8, characterized in that: The round function operation performed by the round function operation module is as follows: In the formula, if y is positive, S y (x) means x is shifted y times to the left. If y is a negative value, S y (x) means x is circularly shifted to the right y times, and m is the number of key words.