Circuit control method, number theoretic transform circuit, and hardware accelerator

By introducing time-domain and frequency-domain decimation units into the number-theory transform circuit, and by employing hybrid basis decomposition and operating mode adjustment, the problem of high hardware cost is solved, and compatibility operations of polynomials with multiple coefficients are achieved, meeting the needs of different fully homomorphic encryption schemes.

CN123158702APending Publication Date: 2026-11-24BEIJING T-HEAD INFORMATION TECHNOLOGY CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202611097093.3
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2026-07-22
Publication Date
2026-11-24

AI Technical Summary

Technical Problem

Existing technologies, when designing dedicated hardware circuits to meet the NTT computation requirements of different fully homomorphic encryption schemes, result in high hardware costs and cannot effectively accommodate polynomial operation requirements with varying numbers of coefficients.

Method used

A number theory transformation circuit with both time-domain decimation and frequency-domain decimation units is adopted. The frequency-domain decimation unit is implemented through hybrid basis decomposition. The operating mode of the frequency-domain decimation unit is adjusted according to the number of coefficients of the polynomial to be processed. The number theory transformation is performed in conjunction with the inter-stage connection transformation unit.

Benefits of technology

Without increasing hardware costs, it supports number theory transformations of polynomials with different numbers of coefficients, and is compatible with the computational scale requirements of different fully homomorphic encryption schemes.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN123158702A_ABST
    Figure CN123158702A_ABST
Patent Text Reader

Abstract

This invention discloses a circuit control method, a number-theoretical transform circuit, and a hardware accelerator. The number-theoretical transform circuit is configured with both a time-domain decimation unit and a frequency-domain decimation unit. A hybrid basis decomposition method is used to implement the first frequency-domain decimation unit. This first frequency-domain decimation unit is configured to perform frequency-domain decimation on coefficient vector sequences with different sequence lengths under different operating modes. Furthermore, the operating mode of the first frequency-domain decimation unit is adjusted according to the number of coefficients in the polynomial to be processed. Therefore, this invention can simultaneously support number-theoretical transforms for polynomials with various numbers of coefficients without increasing hardware costs, thus meeting the computational requirements of different fully homomorphic encryption schemes.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of computer technology, and more specifically, to a circuit control method, a number theory transformation circuit, and a hardware accelerator. Background Technology

[0002] Fully homomorphic encryption allows arbitrary computations to be performed directly on the ciphertext without prior decryption. The final result, after decryption, is identical to the result obtained by direct computation on the plaintext. However, for fully homomorphic encryption schemes based on ring-tolerant learning problems, multiplication on high-order polynomial rings (e.g., multiplication between a ciphertext polynomial and a key polynomial, or between two ciphertext polynomials) is one of the most computationally intensive operations in homomorphic computation, representing a bottleneck. To address this, the Fast Number Theoretic Transform (NTT) can reduce the complexity of polynomial multiplication from O(N^2) to O(N^2). 2 The computation time complexity is reduced to O(NlogN), thus it is applied to polynomial multiplication. However, in different fully homomorphic encryption algorithms, the ciphertext polynomials typically have different parameter settings (e.g., the number of coefficients), resulting in different NTT computation requirements. Existing techniques usually meet these different NTT computation requirements by designing dedicated hardware circuits for the parameters, which incurs high hardware costs. Summary of the Invention

[0003] In view of this, embodiments of the present invention provide a circuit control method, a number theory transformation circuit, and a hardware accelerator to simultaneously support number theory transformations for polynomials with different numbers of coefficients without increasing hardware costs, thereby being compatible with the computational scale requirements of different fully homomorphic encryption schemes.

[0004] In a first aspect, embodiments of the present invention aim to provide a number theory transformation circuit, the number theory transformation circuit comprising: Multiple domain extraction units, wherein the multiple domain extraction units include a time-domain extraction unit and at least one frequency-domain extraction unit, the frequency-domain extraction unit includes at least a first frequency-domain extraction unit, the first frequency-domain extraction unit is implemented by a mixed basis decomposition method, the first frequency-domain extraction unit has different unit operating modes, and the first frequency-domain extraction units in different unit operating modes are respectively used to perform frequency-domain extraction on coefficient vector sequences with different sequence lengths. At least one inter-level connection conversion unit is provided, which is disposed between each of the domain extraction units, and the inter-level connection conversion unit is used to perform inter-level connection conversion processing. The circuit control unit is configured to perform the following steps: Receive at least one polynomial to be processed; The unit operating mode of the first frequency domain decimation unit is adjusted according to the number of coefficients of the polynomial to be processed, and the polynomial to be processed is subjected to number theory transformation through the multiple domain decimation units and the corresponding inter-level connection transformation units.

[0005] Secondly, embodiments of the present invention aim to provide a circuit control method, the method being applicable to number-theory transform circuits, the method comprising: Receive at least one polynomial to be processed; The unit operating mode of the first frequency domain decimation unit is adjusted according to the number of coefficients of the polynomial to be processed. The polynomial to be processed is subjected to number theory transformation through multiple domain decimation units and corresponding inter-level connection transformation units. The multiple domain decimation units include a time domain decimation unit and at least one frequency domain decimation unit. The frequency domain decimation unit includes at least a first frequency domain decimation unit. The first frequency domain decimation unit is implemented by mixed basis decomposition. The first frequency domain decimation unit has different unit operating modes. The first frequency domain decimation units in different unit operating modes are used to perform frequency domain decimation on coefficient vector sequences with different sequence lengths. The inter-level connection transformation units are set between each of the domain decimation units. The inter-level connection transformation units are used to perform inter-level connection transformation processing.

[0006] Thirdly, embodiments of the present invention aim to provide a hardware accelerator, the hardware accelerator comprising: The number-theoretic transformation circuit as described in the first aspect.

[0007] This invention embodiment configures the number-theory transform circuit to include both a time-domain decimation unit and a frequency-domain decimation unit. A hybrid basis decomposition method is used to implement the first frequency-domain decimation unit. Furthermore, the first frequency-domain decimation unit is configured to perform frequency-domain decimation on coefficient vector sequences with different sequence lengths under different operating modes. The operating mode of the first frequency-domain decimation unit is adjusted according to the number of coefficients in the polynomial to be processed. Therefore, this invention embodiment can simultaneously support number-theory transforms for polynomials with various numbers of coefficients without increasing hardware costs, thus being compatible with the computational requirements of different fully homomorphic encryption schemes. Attached Figure Description

[0008] The above and other objects, features and advantages of the present invention will become clearer from the following description of embodiments of the invention with reference to the accompanying drawings, in which: Figure 1 This is a schematic diagram of the number theory transformation circuit according to an embodiment of the present invention; Figure 2 This is a schematic diagram of the number theory transformation circuit according to an embodiment of the present invention; Figure 3This is a schematic diagram of the time-domain decimation butterfly module according to an embodiment of the present invention; Figure 4 This is a schematic diagram of the time-domain decimation butterfly module according to an embodiment of the present invention; Figure 5 This is a schematic diagram of the frequency domain decimation butterfly module according to an embodiment of the present invention; Figure 6 This is a schematic diagram of the frequency domain decimation butterfly module according to an embodiment of the present invention; Figure 7 This is a schematic diagram of a bit-width configurable modular multiplier according to an embodiment of the present invention; Figure 8 This is a schematic diagram of a bit-width configurable modular multiplier according to an embodiment of the present invention; Figure 9 This is a schematic diagram of a bit-width configurable multiplier according to an embodiment of the present invention; Figure 10 This is a schematic diagram of the circuit control method according to an embodiment of the present invention; Figures 11 to 18 This is a schematic diagram of the number theory transformation process according to an embodiment of the present invention; Figure 19 This is a schematic diagram of the circuit control device according to an embodiment of the present invention; Figure 20 This is a schematic diagram of the circuit control unit according to an embodiment of the present invention. Detailed Implementation

[0009] The present application is described below based on embodiments, but it is not limited to these embodiments. In the detailed description of the present application below, certain specific details are described in detail. Those skilled in the art can fully understand the present application without these details. To avoid obscuring the substance of the present application, well-known methods, processes, flows, elements, and circuits are not described in detail.

[0010] Furthermore, those skilled in the art should understand that the accompanying drawings provided herein are for illustrative purposes only and are not necessarily drawn to scale.

[0011] Unless the context explicitly requires it, words such as "including" or "contains" throughout the application should be interpreted as including rather than exclusive or exhaustive; that is, meaning "including but not limited to".

[0012] In the description of this application, it should be understood that the terms "first," "second," etc., are used for descriptive purposes only and should not be construed as indicating or implying relative importance. Furthermore, in the description of this application, unless otherwise stated, "a plurality of" means two or more.

[0013] The solutions described in this specification and embodiments, if involving the processing of personal information, will be processed only on the premise of having a legal basis (such as obtaining the consent of the personal information subject, or being necessary for the performance of a contract), and will only be processed within the scope stipulated or agreed upon. A user's refusal to process personal information beyond what is necessary for basic functions will not affect the user's use of basic functions.

[0014] Figure 1 This is a schematic diagram of a number theory transformation circuit according to an embodiment of the present invention. Figure 1 As shown, the number theory transformation circuit includes multiple domain decimation units, inter-stage connection conversion units 12, and a circuit control unit (not shown in the figure).

[0015] The domain decimation unit refers to a hardware computing unit used to perform divide-and-conquer decomposition and butterfly operation in fast number theory transformation over a finite field. In this embodiment of the invention, the domain decimation unit is configured to have a time-domain decimation unit 111 and a frequency-domain decimation unit 112 coexisting. The coefficients of the polynomial to be processed are transformed into a multi-dimensional (i.e., two-dimensional) polynomial coefficient vector matrix. The time-domain decimation unit 111 and the frequency-domain decimation unit 112 can be used to perform forward transformation time-domain decimation and frequency-domain decimation operations on the coefficient vector sequences of the polynomial coefficient vector matrix in different dimensions, respectively, thereby transforming the polynomial coefficient vector matrix from the time domain to the frequency domain. Simultaneously, to support number theory transformations of polynomials with various numbers of coefficients, the frequency-domain decimation unit 112 can be configured to include at least a first frequency-domain decimation unit 1121. The first frequency domain decimation unit 1121 is implemented using a hybrid basis decomposition method. That is, the first frequency domain decimation unit 1121 can achieve recursive decomposition by cascading multiple sub-frequency domain decimation units with different transform lengths (i.e., the length of the vector sequence that can be processed).

[0016] It's important to note that the core purpose of the fast number-theoretic transform is to convert polynomial coefficients from the time domain to the frequency domain. Two polynomial coefficients converted to the frequency domain can be directly multiplied element-wise, achieving polynomial multiplication that would otherwise require significant computational resources in the time domain. Divide-and-conquer and butterfly operations are the core operations for implementing the fast number-theoretic transform. Depending on the direction of the divide-and-conquer decomposition and the order of the butterfly operations, the domain decimation unit can be divided into a Decimation-In-Time (DIT) unit and a Decimation-In-Frequency (DIF) unit. The DIT unit performs time-domain decimation operations, and the DIF unit performs frequency-domain decimation operations; these are two different hardware computational units capable of implementing the fast number-theoretic transform. During the forward transform, the DIT unit can receive a bit-reversed input sequence, employ a butterfly operation order of multiplying by a rotation factor followed by addition or subtraction, and recursively decompose along the time-domain index direction, ultimately outputting a naturally ordered output sequence. The frequency domain decimation unit can receive input sequences in natural order, employ a butterfly operation order of addition, subtraction, and multiplication by a rotation factor, and recursively decompose along the frequency domain index direction, ultimately outputting a bit-inverted output sequence.

[0017] It should be noted that when implemented using a hybrid basis decomposition method, the first frequency domain decimation unit 1121 internally includes multiple sub-frequency domain decimation units with different transform lengths. By enabling the corresponding internal sub-frequency domain decimation units, the first frequency domain decimation unit 1121 can operate in different unit modes. The first frequency domain decimation unit 1121 operating in different unit modes can be used to perform frequency domain decimation on coefficient vector sequences with different sequence lengths. Schematic, for a first frequency domain decimation unit 1121 composed of 32 two-point sub-frequency domain decimation units and 2 three-point sub-frequency domain decimation units, by individually enabling the two internal three-point sub-frequency domain decimation units, the first frequency domain decimation unit 1121 can operate in the first unit mode. In this mode, the first frequency domain decimation unit 1121 can perform frequency domain decimation on a coefficient vector sequence with a sequence length of 32. Furthermore, by enabling all internal sub-frequency domain decimation units, the first frequency domain decimation unit 1121 can put itself into the second unit operating mode. In this operating mode, the first frequency domain decimation unit 1121 can perform frequency domain decimation on a coefficient vector sequence with a sequence length of 64.

[0018] It should be noted that the transform length of the time-domain decimation unit 11 and the combination method of the sub-frequency-domain decimation units within the first frequency-domain decimation unit 1121 (when the frequency-domain decimation unit 112 also includes other frequency-domain decimation units besides the first frequency-domain decimation unit 1121, the settings also include the transform lengths of the other frequency-domain decimation units) can be determined based on the number of coefficients of the required compatible polynomial. Illustratively, when the number of coefficients of the required compatible polynomial is 1024 or 2048, the transform length of the time-domain decimation unit 11 can be set to 32 points, and the first frequency-domain decimation unit 1121 can be configured to include 32 2-point frequency-domain decimation units and 2 32-point frequency-domain decimation units. In this implementation, a polynomial with 1024 coefficients can be converted into a 32*32 polynomial coefficient vector matrix, which can be processed by the time-domain decimation unit 111 and the first frequency-domain decimation unit 1121 in the first unit operating mode. Furthermore, a polynomial with 2048 coefficients can be converted into a 32*64 polynomial coefficient vector matrix, which can be processed by the time-domain decimation unit 111 and the first frequency-domain decimation unit 1121 operating in the second unit mode.

[0019] Optionally, to ensure the normal operation of each domain extraction unit, a bit reversal module may be provided in each domain extraction unit according to actual needs. Furthermore, to enable data transfer between different circuit units, each circuit unit may also be equipped with input registers and output registers; this application does not impose any limitations on this.

[0020] Inter-level connection and transformation unit 12 refers to an intermediate processing circuit disposed between domain extraction units. Inter-level connection and transformation unit 12 can be used to perform inter-level connection and transformation processing on the polynomial coefficient vector matrix output by the previous domain extraction unit to make it conform to the input requirements of the next domain extraction unit. Optionally, when converting the original one-dimensional polynomial coefficients into a multi-dimensional polynomial coefficient vector matrix, and performing domain extraction on the vector sequences of different dimensions of the polynomial coefficient vector matrix respectively, the inseparable cross terms generated by index decomposition cannot be covered by a single-dimensional transformation. In this regard, inter-level connection and transformation unit 12 can be configured to include a rotation factor modular multiplication module (as shown in rotation factor modular multiplication module 121). The rotation factor modular multiplication module can be used to perform rotation factor complement multiplication on the polynomial coefficient vector matrix output by the previous domain extraction unit, thereby compensating for the cross terms. Furthermore, the domain extraction unit can typically only perform domain extraction operations on the coefficient vector sequence of the polynomial coefficient vector matrix in a fixed dimension. In this regard, inter-level connection and transformation unit 12 can be configured to include a transpose module (as shown in transpose module 122). This transpose module can be used to transpose the polynomial coefficient vector matrix output by the previous domain extraction unit, so that the next domain extraction unit can perform domain extraction operation on the coefficient vector sequence of the correct dimension.

[0021] A circuit control unit refers to a circuit unit with logic control functions. In this embodiment of the invention, the circuit control unit can control the unit operating mode of the first frequency domain decimation unit 1121. Optionally, the circuit control unit can be described by relevant personnel using a hardware description language (such as VHDL or Verilog), and then the operating logic can be mapped onto a programmable integrated circuit (such as a field programmable gate array, FPGA) by programming. Alternatively, in some embodiments, each circuit unit and each functional module can also be implemented using an ASIC (Application-Specific Integrated Circuit), and this application does not impose any limitations on this.

[0022] Specifically, in Figure 1 In the number theory transformation circuit shown, the circuit control unit can receive at least one polynomial to be processed, adjust the unit working mode of the first frequency domain decimation unit 1121 according to the number of coefficients of the polynomial to be processed, and perform number theory transformation on each polynomial to be processed through multiple domain decimation units 11 and corresponding inter-stage connection transformation units 12.

[0023] Therefore, by setting the number-theory transformation circuit to coexist with the time-domain decimation unit and the frequency-domain decimation unit, and by using a hybrid basis decomposition method to implement the first frequency-domain decimation unit in the frequency-domain decimation unit, and further setting the first frequency-domain decimation unit to perform frequency-domain decimation on coefficient vector sequences with different sequence lengths in different working modes, and adjusting the working mode of the first frequency-domain decimation unit according to the number of coefficients of the polynomial to be processed, the embodiments of the present invention can simultaneously support number-theory transformation for polynomials to be processed with multiple different numbers of coefficients without increasing hardware costs, thereby being compatible with the computational scale requirements of different fully homomorphic encryption schemes.

[0024] Figure 1 The number of frequency domain decimation units and interstage connection conversion units shown in the diagram are for illustrative purposes only. In actual applications, the specific number of frequency domain decimation units and interstage connection conversion units can be set according to actual needs.

[0025] Optionally, different polynomial coefficients may need to be converted into polynomial coefficient vector matrices of different dimensions for processing. As one configuration, to handle polynomial coefficient vector matrices of different dimensions, in addition to the first frequency domain decimation unit, the number-theory transform circuit may also include cascaded second and third frequency domain decimation units. It should be understood that when the number of cascaded frequency domain decimation units changes, the number of inter-stage connection conversion units also needs to be adjusted to ensure that each domain decimation unit has a corresponding inter-stage connection conversion unit; this application does not impose any limitations on this.

[0026] Figure 2 This is a schematic diagram of a number theory transformation circuit according to an embodiment of the present invention. Figure 2 As shown, the number theory transformation circuit includes multiple domain decimation units, multiple inter-stage connection transformation units 22, and a circuit control unit (not shown in the figure).

[0027] The domain decimation unit refers to a hardware computing unit used to perform divide-and-conquer decomposition and butterfly operation in fast number theory transformation over a finite domain. In this embodiment of the invention, the domain decimation unit may include a time-domain decimation unit 211 and a frequency-domain decimation unit 212. However, compared to the above embodiment, the frequency-domain decimation unit 212 may include a first frequency-domain decimation unit 2121, a second frequency-domain decimation unit 2122, and a third frequency-domain decimation unit 2123.

[0028] Inter-level connection and conversion unit 22 refers to the intermediate processing circuit set between domain extraction units. Inter-level connection and conversion unit 22 can be used to perform inter-level connection and conversion processing on the polynomial coefficient vector matrix output by the previous domain extraction unit so that it meets the input requirements of the next domain extraction unit.

[0029] In this embodiment of the invention, the coefficients of the polynomial to be processed are transformed into a multi-dimensional (i.e., two-dimensional or four-dimensional) polynomial coefficient vector matrix. Correspondingly, by enabling the corresponding internal frequency domain decimation unit and adjusting the unit operating mode of the first frequency domain decimation unit, the number theory transform circuit can support the processing of polynomial coefficient vector matrices of different sizes.

[0030] Schematic, a polynomial with 1024 coefficients can be converted into a two-dimensional 32*32 polynomial coefficient vector matrix. By individually enabling the time-domain decimation unit 211 and the first frequency-domain decimation unit 2121, and adjusting the first frequency-domain decimation unit 2121 to the first unit operating mode, the number-theory transform circuit can perform domain decimation operations on the coefficient vector sequences of the polynomial coefficient vector matrix in two different dimensions, thereby transforming the polynomial coefficient vector matrix from the time domain to the frequency domain.

[0031] A polynomial with 2048 coefficients can be converted into a 32*64 two-dimensional polynomial coefficient vector matrix. By individually enabling the time-domain decimation unit 211 and the first frequency-domain decimation unit 2121, and adjusting the first frequency-domain decimation unit 2121 to the second unit operating mode, the number-theory transformation circuit can perform domain decimation operations on the coefficient vector sequences of the polynomial coefficient vector matrix in two different dimensions, thereby transforming the polynomial coefficient vector matrix from the time domain to the frequency domain.

[0032] A polynomial with 65,536 coefficients can be transformed into a four-dimensional polynomial coefficient vector matrix of 32*64*16*2. By enabling the time-domain decimation unit 211, the first frequency-domain decimation unit 2121, the second frequency-domain decimation unit 2122, and the third frequency-domain decimation unit 2123, and adjusting the first frequency-domain decimation unit 2121 to the second unit operating mode, the number-theory transformation circuit can perform domain decimation operations on the coefficient vector sequences of the polynomial coefficient vector matrix in four different dimensions, thereby transforming the polynomial coefficient vector matrix from the time domain to the frequency domain.

[0033] A circuit control unit refers to a circuit unit with logic control functions. In this embodiment of the invention, in addition to controlling the unit operating mode of the first frequency domain decimation unit 1121, the circuit control unit can also enable control of the corresponding frequency domain decimation units. Optionally, the enable control of each frequency domain decimation unit by the circuit control unit can be implemented by a multiplexer (as shown in multiplexer 23), and this application does not limit this.

[0034] Specifically, in Figure 2 In the number theory transformation circuit shown, the circuit control unit can receive at least one polynomial to be processed, enable the corresponding frequency domain decimation unit according to the number of coefficients of the polynomial to be processed, and adjust the unit working mode of the first frequency domain decimation unit 2121. Then, the polynomial to be processed is transformed by multiple domain decimation units and the corresponding inter-stage connection transformation unit 22.

[0035] Therefore, by setting up a larger number of frequency domain decimation units and adjusting the enable of the frequency domain decimation units according to the number of coefficients of the polynomial to be processed, the embodiments of the present invention can simultaneously support number theory transformations for polynomials with a larger number of coefficients without increasing hardware costs, thereby being compatible with the computational scale requirements of different fully homomorphic encryption schemes.

[0036] It should be noted that in different fully homomorphic encryption algorithms, in addition to the different number of polynomial coefficients, the coefficient bit width of different ciphertext polynomials is also usually different. For example, the coefficient bit width of ciphertext polynomials can typically be 32 bits, 45 bits, and 64 bits, etc. Therefore, the field extraction unit in this embodiment of the invention also needs to implement number theory transformation support for polynomials to be processed with various different coefficient bit widths.

[0037] Optionally, to enable the domain decimation unit to support number-theoretic transformations of polynomials with various coefficient bit widths, embodiments of the present invention can employ configurable-width butterfly units to implement the aforementioned domain decimation unit. Specifically, the time-domain decimation unit can be implemented using a time-domain decimation butterfly module. Each frequency-domain decimation unit can be implemented using a frequency-domain decimation butterfly module. The time-domain decimation butterfly module and the frequency-domain decimation butterfly module are configurable-width butterfly units. The time-domain decimation butterfly module and the frequency-domain decimation butterfly module have different module operating modes. The time-domain decimation butterfly module in different module operating modes can be used to perform time-domain decimation butterfly operations on polynomial coefficient vectors with different vector lengths. The frequency-domain decimation butterfly module in different module operating modes can be used to perform frequency-domain decimation butterfly operations on polynomial coefficient vectors with different vector lengths. It should be understood that the time-domain decimation butterfly module and the frequency-domain decimation butterfly module can respectively implement the basic butterfly operations in the time-domain decimation operation and the frequency-domain decimation operation.

[0038] Optionally, both the time-domain decimation butterfly module and the frequency-domain decimation butterfly module can be implemented by combining a configurable-width modular multiplier, a configurable-width modular adder, and a configurable-width modular subtractor. Here, a configurable-width modular multiplier refers to a modular multiplier whose operational bit width can be adjusted. A configurable-width modular adder refers to a modular adder whose operational bit width can be adjusted. A configurable-width modular subtractor refers to a modular subtractor whose operational bit width can be adjusted. It should be noted that by adjusting the operational bit width of the internal configurable-width modular multiplier, adder, and subtractor, the time-domain decimation butterfly module and the frequency-domain decimation butterfly module perform domain decimation butterfly operations on polynomial coefficient vectors with different vector lengths.

[0039] Figure 3 This is a schematic diagram of the time-domain decimation butterfly module according to an embodiment of the present invention. It should be understood that... Figure 3 The content shown may be an internal schematic diagram of the time-domain decimation butterfly module when it is in the first module operating mode. In the first module operating mode, the time-domain decimation butterfly module can perform time-domain decimation butterfly operations on a polynomial coefficient vector having a first preset vector length (e.g., 64 bits). Figure 3As shown, the time-domain decimation butterfly module 3 includes a bit-width configurable modular multiplier 31, a bit-width configurable modular adder 32, and a bit-width configurable modular subtractor 33. It should be understood that, since a butterfly operation order of multiplying by a rotation factor before addition or subtraction is used, the time-domain decimation butterfly module may also include a register set 34 to temporarily store another input vector while performing a rotation factor modular multiplication operation on one input vector. This application does not impose any limitations on this.

[0040] The configurable-width modular multiplier 31, configurable-width modular adder 32, and configurable-width modular subtractor 33 can refer to modular multipliers, adders, and subtractors whose operational bit widths can be adjusted, respectively. In the first module's operating mode, the configurable-width modular multiplier 31 can be configured to perform modular multiplication operations with a first preset vector length. The configurable-width modular adder 32 can be configured to perform modular addition operations with a first preset vector length. The configurable-width modular subtractor 33 can be configured to perform modular subtraction operations with a first preset vector length. Indicatively, the first preset vector length can be 64.

[0041] It should be noted that, in this embodiment of the invention, the time-domain decimation butterfly module 3 can be used to implement the time-domain decimation butterfly operation process. The time-domain decimation butterfly operation process can be expressed by the following mathematical formula:

[0042]

[0043]

[0044] in, and These are the two input vectors for the time-domain extraction butterfly module. As the intermediate vector, For rotation factor, For modulus, and These are the two output vectors of the time-domain decimation butterfly module. It should be understood that in this implementation, the input vector... Input vector Rotation factor All are vectors with a first preset vector length.

[0045] Specifically, in Figure 3 In the temporal decimation butterfly module shown, after being input into the temporal decimation butterfly module, the input vector... and input vector The input bit-width configurable modular multiplier 31 and register group 34 can be respectively input to the configurable modular multiplier 31. In the configurable modular multiplier 31, the input bit-width configurable modular multiplier 31 is based on the input vector. and rotation factor implement The modular multiplication operation is used to obtain the intermediate vector. Furthermore, the bit-width configurable adder 32 and the bit-width configurable subtractor 33 will use the input vector... and intermediate vector As input, execute respectively Modulo addition and Modulo subtraction is performed to obtain the output vector. and .

[0046] It should be noted that the configuration of the bit-width configurable modular multiplier 31, bit-width configurable modular adder 32, and bit-width configurable modular subtractor 33 in the time-domain decimation butterfly module 3 needs to match the time-domain decimation butterfly operation process, and this application does not impose any restrictions on this.

[0047] Figure 4 This is a schematic diagram of the time-domain decimation butterfly module according to an embodiment of the present invention. It should be understood that... Figure 4 The content shown may be an internal diagram of the time-domain decimation butterfly module when it is in the second module operating mode. In the second module operating mode, the time-domain decimation butterfly module can perform time-domain decimation butterfly operations in parallel on polynomial coefficient vectors having a second preset vector length (e.g., 32 bits). Figure 4 As shown, the time-domain decimation butterfly module 4 includes a bit-width configurable modular multiplier 41, a bit-width configurable modular adder 42, and a bit-width configurable modular subtractor 43. It should be understood that, since a butterfly operation order of multiplying by a rotation factor before addition or subtraction is used, the time-domain decimation butterfly module may also include a register group 44 to temporarily store another input vector while performing a rotation factor modular multiplication operation on one input vector. This application does not impose any limitations on this.

[0048] The configurable-width modular multiplier 41, configurable-width modular adder 42, and configurable-width modular subtractor 43 can refer to modular multipliers, adders, and subtractors with adjustable bit widths, respectively. In the second module operating mode, the configurable-width modular multiplier 41 can be configured to perform modular multiplication operations of a second preset vector length in parallel. The configurable-width modular adder 42 can be configured to perform modular addition operations of a second preset vector length in parallel. The configurable-width modular subtractor 43 can be configured to perform modular subtraction operations of a second preset vector length in parallel. Indicatively, the first preset vector length can be 32.

[0049] It should be noted that, in this embodiment of the invention, the time-domain decimation butterfly module 4 can be used to implement two parallel time-domain decimation butterfly operations. It should be understood that since the two time-domain decimation butterfly operations are identical, only a single time-domain decimation butterfly operation is given below. The single time-domain decimation butterfly operation can be expressed using the following mathematical formula:

[0050]

[0051]

[0052] in, and These are the two input vectors for the time-domain extraction butterfly module. As the intermediate vector, For rotation factor, For modulus, and These are the two output vectors of the time-domain decimation butterfly module. It should be understood that in this implementation, the input vector... Input vector Rotation factor All are vectors with the second preset vector length.

[0053] It should be understood that, in this embodiment of the invention, when performing time-domain decimation butterfly operations on polynomial coefficient vectors having a second preset vector length (e.g., 32 bits) in parallel, two pairs of input vectors can be concatenated and then input into the time-domain decimation butterfly module. For example, for input vector pairs... 1 and 1 and input vector pairs 2 and 2. Input vector 1 can be used with the input vector 2. Concatenate the input vectors. 1 can be used with the input vector 2. Perform concatenation. The concatenated input vector. 2 and 2 will be input into the time domain extraction butterfly module.

[0054] Specifically, in Figure 4 In the temporal decimation butterfly module shown, after being input into the temporal decimation butterfly module, the input vector... and input vector The input bit-width configurable modular multiplier 41 and register group 44 can be respectively input to the configurable modular multiplier 41. In the configurable modular multiplier 41, the input bit-width configurable modular multiplier 41 is based on the input vector. and rotation factor Execute in parallel and The modular multiplication operation is used to obtain the intermediate vectors respectively. and Furthermore, the bit-width configurable modulator 42 will use the input vector and intermediate vector Execute in parallel as input and Modulo addition operations are performed to obtain the output vectors respectively. and And, the bit-width configurable modulator 43 will use the input vector and intermediate vector Execute in parallel as input and Modulo addition operations are performed to obtain the output vectors respectively. and .

[0055] It should be noted that the configuration of the bit-width configurable modular multiplier 41, bit-width configurable modular adder 42, and bit-width configurable modular subtractor 43 in the time-domain decimation butterfly module 4 needs to match the time-domain decimation butterfly operation process, and this application does not impose any restrictions on this.

[0056] Figure 5 This is a schematic diagram of the frequency domain decimation butterfly module according to an embodiment of the present invention. It should be understood that... Figure 5 The content shown may be an internal schematic diagram of the frequency domain decimation butterfly module when it is in the first module operating mode. In the first module operating mode, the frequency domain decimation butterfly module can perform frequency domain decimation butterfly operations on a polynomial coefficient vector having a first preset vector length (e.g., 64 bits). Figure 5 As shown, the frequency domain decimation butterfly module 5 includes a bit-width configurable modular multiplier 51, a bit-width configurable modular adder 52, and a bit-width configurable modular subtractor 53. It should be understood that, due to the butterfly operation sequence of addition / subtraction followed by multiplication by the twitch factor, the frequency domain decimation butterfly module may also include a register group 54 to temporarily store one output vector while performing the twitch factor modular multiplication operation to obtain another output vector; this application does not impose any limitations on this.

[0057] The configurable-width modular multiplier 51, configurable-width modular adder 52, and configurable-width modular subtractor 53 can refer to modular multipliers, adders, and subtractors whose operational bit widths can be adjusted, respectively. In the first module's operating mode, the configurable-width modular multiplier 51 can be configured to perform modular multiplication operations with a first preset vector length. The configurable-width modular adder 52 can be configured to perform modular addition operations with a first preset vector length. The configurable-width modular subtractor 53 can be configured to perform modular subtraction operations with a first preset vector length. Indicatively, the first preset vector length can be 64.

[0058] It should be noted that, in this embodiment of the invention, the frequency domain decimation butterfly module 5 can be used to implement the frequency domain decimation butterfly operation process. The frequency domain decimation butterfly operation process can be expressed by the following mathematical formula:

[0059]

[0060]

[0061] in, and The two input vectors of the frequency domain decimation butterfly module are used. As the intermediate vector, For rotation factor, For modulus, and These are the two output vectors of the frequency domain decimation butterfly module. It should be understood that in this implementation, the input vector... Input vector Rotation factor All are vectors with a first preset vector length.

[0062] Specifically, in Figure 5 In the frequency domain decimation butterfly module shown, after being input into the frequency domain decimation butterfly module, the input vector... and input vector A configurable bit-width modulo adder 52 and a configurable bit-width modulo subtractor 53 can be input simultaneously. In the configurable bit-width adder 52, the bit-width modulo adder 52 is based on the input vector. and input vector implement Modulo addition is used to obtain the output vector. Output vector It will be temporarily stored in the input bit-width configurable subtractor 53 for later use with the output vector. They are output together. In the bit-width configurable modulus subtractor 53, the bit-width configurable modulus adder 52 is based on the input vector. and input vector implement Modulo subtraction is used to obtain the intermediate vector. Furthermore, the bit-width configurable modular multiplier 51 will use the intermediate vector For input, execute The modular multiplication operation is used to obtain the output vector. .

[0063] It should be noted that the configuration of the bit-width configurable modular multiplier 51, bit-width configurable modular adder 52, and bit-width configurable modular subtractor 53 in the frequency domain decimation butterfly module 5 needs to match the frequency domain decimation butterfly operation process, but this application does not impose any restrictions on this.

[0064] Figure 6 This is a schematic diagram of the frequency domain decimation butterfly module according to an embodiment of the present invention. It should be understood that... Figure 6The diagram shown may be an internal illustration of the frequency domain decimation butterfly module in its second module operating mode. In this mode, the frequency domain decimation butterfly module can perform frequency domain decimation butterfly operations on a polynomial coefficient vector having a second preset vector length (e.g., 32 bits). Figure 6 As shown, the frequency domain decimation butterfly module 6 includes a bit-width configurable modular multiplier 61, a bit-width configurable modular adder 62, and a bit-width configurable modular subtractor 63. It should be understood that, due to the butterfly operation sequence of addition / subtraction followed by multiplication by the twitch factor, the frequency domain decimation butterfly module may also include a register group 64 to temporarily store one output vector while performing the twitch factor modular multiplication operation to obtain another output vector; this application does not impose any limitations on this.

[0065] The configurable-width modular multiplier 61, configurable-width modular adder 62, and configurable-width modular subtractor 63 can refer to modular multipliers, adders, and subtractors with adjustable bit widths, respectively. In the second module operating mode, the configurable-width modular multiplier 61 can be configured to perform modular multiplication operations of a second preset vector length in parallel. The configurable-width modular adder 62 can be configured to perform modular addition operations of a second preset vector length in parallel. The configurable-width modular subtractor 63 can be configured to perform modular subtraction operations of a second preset vector length in parallel. Indicatively, the second preset vector length can be 32.

[0066] It should be noted that, in this embodiment of the invention, the frequency domain decimation butterfly module 6 can be used to implement the frequency domain decimation butterfly operation process. It should be understood that since the two frequency domain decimation butterfly operation processes are identical, only the single frequency domain decimation butterfly operation process is given below. The single frequency domain decimation butterfly operation process can be expressed using the following mathematical formula:

[0067]

[0068]

[0069] in, and The two input vectors of the frequency domain decimation butterfly module are used. As the intermediate vector, For rotation factor, For modulus, and These are the two output vectors of the frequency domain decimation butterfly module. It should be understood that in this implementation, the input vector... Input vector Rotation factor All are vectors with the second preset vector length.

[0070] It should be understood that, in this embodiment of the invention, when performing frequency domain decimation butterfly operations on polynomial coefficient vectors having a second preset vector length (e.g., 32 bits) in parallel, two pairs of input vectors can be concatenated and then input into the frequency domain decimation butterfly module. For example, for input vector pairs... 1 and 1 and input vector pairs 2 and 2. Input vector 1 can be used with the input vector 2. Concatenate the input vectors. 1 can be used with the input vector 2. Perform concatenation. The concatenated input vector. 2 and 2. The input frequency domain decimation butterfly module.

[0071] Specifically, in Figure 6 In the frequency domain decimation butterfly module shown, after being input into the frequency domain decimation butterfly module, the input vector... 2 and 2 can be simultaneously input to a bit-width configurable modulo adder 62 and a bit-width configurable modulo subtractor 63. In the bit-width configurable modulo adder 62, the bit-width configurable modulo adder 62 will be based on the input vector... 2 and 2. Execute in parallel and Modulo addition is used to obtain the output vector. and Output vector and The input bit-width configurable subtractor 63 will be temporarily stored in the input bit-width configurable subtractor 63 for later use with the output vector. and They are output together. In the bit-width configurable modulus subtractor 63, the bit-width configurable modulus adder 62 is based on the input vector. 2 and 2. Execute in parallel and Modulo subtraction is used to obtain the intermediate vector. and Furthermore, the bit-width configurable modular multiplier 61 will use the intermediate vector and For input, execute and The modular multiplication operation is used to obtain the output vector. and .

[0072] It should be noted that the configuration of the bit-width configurable modular multiplier 61, bit-width configurable modular adder 62, and bit-width configurable modular subtractor 63 in the frequency domain decimation butterfly module 6 needs to match the frequency domain decimation butterfly operation process, but this application does not impose any restrictions on this.

[0073] Optionally, to enable the configurable-width modular multiplier to process vectors of different bit widths, it can be implemented by combining configurable-width multipliers. Here, a configurable-width multiplier can refer to a multiplier whose operational bit width can be adjusted.

[0074] Figure 7 This is a schematic diagram of a bit-width configurable modular multiplier according to an embodiment of the present invention. It should be understood that... Figure 7 The content shown may be an internal diagram of a bit-width configurable modular multiplier performing a modular multiplication operation on a vector with a bit width of a first preset vector length (e.g., 64 bits). Figure 7 As shown, the bit-width configurable multiplier 7 may include a first bit-width configurable multiplier 71, a first shift unit 72, a second bit-width configurable multiplier 73, a second shift unit 74, a third bit-width configurable multiplier 75, a first subtractor 76, a first correction sub-circuit 77, and a second correction sub-circuit 78.

[0075] The first-width configurable multiplier 71 can be used to perform a multiplication operation based on the input data with a first preset vector length to obtain the original multiplication result. It should be understood that the input data can be the first preset vector length, which can specifically be the input vector and rotation factor in the above embodiments, or the intermediate vector and rotation factor in the above embodiments. This application does not limit this.

[0076] The first shift unit 72 can be used to perform shift operations based on the original multiplication result to obtain a high-order truncation value. It should be understood that the first shift unit 72 can truncate bits above the modulus width of the original multiplication result based on the modulus bit width of the target modulus, thereby obtaining the high-order truncation value. For example, if the original multiplication result is 128 bits and the modulus bit width is 64 bits, then the first shift unit 72 can truncate the first 64 bits of the original multiplication result to obtain the high-order truncation value. It should be understood that this pre-calculated value is specifically the reciprocal of the modulus, multiplied to an integer.

[0077] The second bit-width configurable multiplier 73 can be used to perform a multiplication operation of a first preset vector length based on the high-bit truncation value and the pre-calculated value to obtain the corresponding intermediate result. It should be understood that multiplying the high-bit truncation value and the pre-calculated value here is equivalent to calculating an approximate quotient of the original multiplication result and the modulus. Furthermore, if the high-bit truncation value and the pre-calculated value do not reach the first preset vector length, they can be padded; this application does not impose any limitations on this.

[0078] The second shift unit 74 can be used to perform shift operations based on intermediate results to obtain an approximate quotient. It should be understood that this shift operation can be used to compensate for prior high-order bit truncation operations and the multiplication factor of pre-calculated values.

[0079] The third bit-width configurable multiplier 75 can be used to perform a multiplication operation of a first preset vector length based on the quotient approximation and the target modulus to obtain the subtractive value.

[0080] The first subtractor 76 can be used to perform a subtraction operation based on the value to be subtracted and the original multiplication result to obtain the value to be reduced.

[0081] The first correction sub-circuit 77 can be used to select, based on the comparison result between the value to be reduced and the target modulus, to output either the value to be reduced as the first reduction result, or to output the difference between the value to be reduced and the target modulus as the first reduction result. Optionally, as one implementation, the first correction sub-circuit 777 can be configured to include a comparator 771, a third subtractor 772, and a corresponding output selector 773. It should be understood that here, the comparator 771 is used to compare the value to be reduced and the target modulus. The third subtractor 772 can be used to calculate the difference between the value to be reduced and the target modulus. The output selector 773 is then used to select, based on the comparison result of the comparator 771, to output either the value to be reduced or the difference between the value to be reduced and the target modulus.

[0082] The second correction sub-circuit 78 can be used to select, based on the comparison result of the first reduction result and the target modulus, whether to output the first reduction result as the second reduction result, or to output the difference between the first reduction result and the target modulus as the second reduction result. Optionally, as one implementation, the second correction sub-circuit 78 can be configured to include a comparator 781, a fourth subtractor 782, and a corresponding output selector 783. It should be understood that here, the comparator 781 is used to compare the first reduction result and the target modulus. The fourth subtractor 782 can be used to calculate the difference between the first reduction result and the target modulus. The output selector 783 is then used to select, based on the comparison result of the comparator 781, to output either the first reduction result or the difference between the first reduction result and the target modulus.

[0083] Specifically, in Figure 7In the configurable bit-width modular multiplier shown, the input data a and b that need to participate in the modular multiplication operation can first be input into the first configurable bit-width multiplier 71. The first configurable bit-width multiplier 71 can perform a multiplication operation based on the input data a and b to obtain the original multiplication result c (i.e., the product of the input data a and b). The original multiplication result c can be input into the first shift unit 72. The first shift unit 72 can perform a shift operation based on the original multiplication result c to truncate the bits in the original multiplication result c that are higher than the target modulus p, thereby obtaining the high-order truncation value d. The high-order truncation value d can be input into the second configurable bit-width multiplier 73. The second configurable bit-width multiplier 73 can perform a multiplication operation of a first preset vector length based on the high-order truncation value d and the pre-calculated value μ to obtain the corresponding intermediate result e. The intermediate result e can be input into the second shift unit 74. The second shift unit 74 can perform a shift operation based on the intermediate result e to compensate for the prior high-bit approximation truncation operation and the magnification factor of the pre-calculated value μ, thereby obtaining a quotient approximation value f. The quotient approximation value f can be input to the third bit-width configurable multiplier 75. The third bit-width configurable multiplier 75 can perform a multiplication operation of a first preset vector length based on the quotient approximation value f and the target modulus p to obtain the subtraction value g (i.e., the product of the quotient approximation value f and the target modulus p). The subtraction value g can be input to the first subtractor 76. The first subtractor 76 can perform a subtraction operation based on the subtraction value g and the original multiplication result c to obtain the reduced value h. The reduced value h can be input to the first correction sub-circuit 77. The first correction sub-circuit 77 can choose to output the reduced value h as the first reduced result i based on the comparison result between the reduced value h and the target modulus p, or choose to output the difference between the reduced value h and the target modulus p as the first reduced result i. The second correction circuit 78 can be used to select, based on the comparison result of the first reduction result i and the target modulus p, whether to output the first reduction result i as the second reduction result j, or to output the difference between the first reduction result i and the target modulus p as the second reduction result j. Thus, the bit-width configurable modular multiplier can obtain the modular multiplication result j of a and b.

[0084] Figure 8 This is a schematic diagram of a bit-width configurable modular multiplier according to an embodiment of the present invention. It should be understood that... Figure 8 The content shown may be an internal diagram of a bit-width configurable modular multiplier performing parallel modular multiplication operations on a bit-width vector of a second preset length (e.g., 64 bits). Figure 8 As shown, the bit-width configurable multiplier 8 may include a first bit-width configurable multiplier 81, a first shift unit 82, a second bit-width configurable multiplier 83, a second shift unit 84, a third bit-width configurable multiplier 85, a first subtractor 86, a first correction sub-circuit 87, and a second correction sub-circuit 88.

[0085] The first configurable multiplier 81 can be used to perform multiplication operations of a second preset vector length in parallel based on the input data to obtain the original multiplication result. It should be understood that the input data can be the second preset vector length, which can specifically be the input vector and rotation factor in the above embodiments, or the intermediate vector and rotation factor in the above embodiments. This application does not limit this.

[0086] The first shift unit 82 can be used to perform shift operations based on the original multiplication result to obtain a high-order truncation value. It should be understood that the first shift unit 82 can truncate bits above the modulus width of the original multiplication result based on the modulus bit width of the target modulus, thereby obtaining the high-order truncation value. For example, if the original multiplication result is 128 bits and the modulus bit width is 64 bits, then the first shift unit 82 can truncate the first 64 bits of the original multiplication result to obtain the high-order truncation value. It should be understood that this pre-calculated value is specifically the reciprocal of the modulus, multiplied to an integer.

[0087] The second bit-width configurable multiplier 83 can be used to perform multiplication operations of a second preset vector length in parallel based on the high-bit truncation value and the pre-calculated value to obtain the corresponding intermediate result. It should be understood that multiplying the high-bit truncation value and the pre-calculated value here is equivalent to calculating an approximate quotient of the original multiplication result and the modulus. Furthermore, if the high-bit truncation value and the pre-calculated value do not reach the second preset vector length, they can be padded; this application does not impose any limitations on this.

[0088] The second shift unit 84 can be used to perform shift operations based on intermediate results to obtain an approximate quotient. It should be understood that this shift operation can be used to compensate for prior high-order bit truncation operations and the multiplication factor of the pre-calculated value.

[0089] The third bit-width configurable multiplier 85 can be used to perform multiplication operations of a second preset vector length in parallel based on the quotient approximation and the target modulus to obtain the subtractive value.

[0090] The first subtractor 86 can be used to perform a subtraction operation based on the value to be subtracted and the original multiplication result to obtain the value to be reduced.

[0091] The first correction sub-circuit 87 can be used to select, based on the comparison result between the value to be reduced and the target modulus, to output the value to be reduced as the first reduction result, or to output the difference between the value to be reduced and the target modulus as the first reduction result. Optionally, the first correction sub-circuit 87 may include two comparators 871, a third subtractor 872, and two corresponding output selectors 873. It should be understood that, compared to the above embodiment, the two comparators 871 and the two output selectors 873 here can achieve the reduction of the value to be reduced by multiplexing the third subtractor 872.

[0092] The second correction sub-circuit 88 can be used to select, based on the comparison result of the first reduction result and the target modulus, whether to output the first reduction result as the second reduction result or to output the difference between the first reduction result and the target modulus as the second reduction result. Optionally, the second correction sub-circuit 88 can be configured to include a comparator 881, a fourth subtractor 882, and a corresponding output selector 883. It should be understood that, compared to the above embodiment, the two comparators 881 and the two output selectors 883 here can achieve the reduction of the value to be reduced by multiplexing the fourth subtractor 882.

[0093] Specifically, in Figure 8In the configurable bit-width modular multiplier shown, the input data a and b, and a' and b', which need to participate in the modular multiplication operation, can first be input into the first configurable bit-width multiplier 81. The first configurable bit-width multiplier 81 can perform a multiplication operation of a second preset vector length in parallel based on the input data a and b and a' and b' to obtain the original multiplication results c (i.e., the product of input data a and b) and c' (i.e., the product of input data a' and b'). The original multiplication results c and c' can be input into the first shift unit 82. The first shift unit 82 can perform shift operations based on the original multiplication results c and c' respectively to truncate the bits in the original multiplication result c that are higher than the target modulus p, thereby obtaining the high-order truncation value d, and to truncate the bits in the original multiplication result c' that are higher than the target modulus p, thereby obtaining the high-order truncation value d'. The high-order truncation values ​​d and d' can be input into the second configurable bit-width multiplier 83. The second bit-width configurable multiplier 83 can perform multiplication operations of a second preset vector length in parallel based on the high-bit truncation value d and the pre-calculated value μ, and the high-bit truncation value d' and the pre-calculated value μ, to obtain corresponding intermediate results e (i.e., the product of the high-bit truncation value d and the pre-calculated value μ) and e' (i.e., the product of the high-bit truncation value d' and the pre-calculated value μ). The intermediate results e and e' can be input into the second shift unit 84. The second shift unit 84 can perform shift operations based on the intermediate results e and e' respectively to compensate for the previous high-bit approximation truncation operation and the magnification factor of the pre-calculated value μ, thereby obtaining quotient approximations f and f'. The quotient approximations f and f' can be input into the third bit-width configurable multiplier 85. The third bit-width configurable multiplier 85 can perform multiplication operations of a second preset vector length in parallel based on the quotient approximation f and the target modulus p, and the quotient approximation f' and the target modulus p, to obtain the subtractive value g (i.e., the product of the quotient approximation f and the target modulus p) and g' (i.e., the product of the quotient approximation f' and the target modulus p). The subtractive values ​​g and g' can be input to the first subtractor 86. The first subtractor 86 can perform subtraction operations based on the subtractive value g and the original multiplication result c to obtain the reduced value h (i.e., the difference between the original multiplication result c and the subtractive value g), and perform subtraction operations based on the subtractive value g' and the original multiplication result c' to obtain the reduced value h' (i.e., the difference between the original multiplication result c' and the subtractive value g'). The reduced values ​​h and h' can be input to the first correction sub-circuit 87. The first correction circuit 87 can select, based on the comparison result between the value to be reduced h and the target modulus p, to output the value to be reduced as the first reduction result i, or select the difference between the value to be reduced h and the target modulus p as the first reduction result i, and select, based on the comparison result between the value to be reduced h' and the target modulus p, to output the value to be reduced h' as ​​the first reduction result i', or select the difference between the value to be reduced h' and the target modulus p as the first reduction result i'.The second correction circuit 88 can be used to select, based on the comparison result of the first reduction result i and the target modulus p, to output the first reduction result i as the second reduction result j, or to output the difference between the first reduction result i and the target modulus p as the second reduction result j; and to select, based on the comparison result of the first reduction result i' and the target modulus p, to output the first reduction result i' as the second reduction result j', or to output the difference between the first reduction result i' and the target modulus p as the second reduction result j'. Thus, the bit-width configurable modular multiplier can obtain the modular multiplication result j of a and b and the modular multiplication result j' of a' and b'.

[0094] Alternatively, as one implementation, the aforementioned bit-width configurable multiplier can be implemented by combining multipliers, adders, and subtractors.

[0095] Figure 9 This is a schematic diagram of a bit-width configurable multiplier according to an embodiment of the present invention. Figure 9 As shown, the bit-width configurable multiplier 9 includes a first multiplier 91, a second multiplier 92, a first adder 93, a second adder 94, a third multiplier 95, a first subtractor 96, a second subtractor 97, a third adder 98, and an output selector 99.

[0096] The system comprises the following components: a first multiplier 91 performs a multiplication operation of a second preset vector length based on a first input and a third input to obtain a first product; a second multiplier 92 performs a multiplication operation of a second preset vector length based on a second input and a fourth input to obtain a second product; a first adder 93 performs an addition operation of a second preset vector length based on a first input and a second input to obtain a first sum; a second adder 94 performs an addition operation of a second preset vector length based on a third input and a fourth input to obtain a second sum; a third multiplier 95 performs a multiplication operation of a second preset vector length based on the first sum and the second sum to obtain a third product; a first subtractor 96 performs a subtraction operation of a second preset vector length based on the third product and the first product to obtain a first difference; a second subtractor 97 performs a subtraction operation of a second preset vector length based on the first difference and the second product to obtain a second difference; and a third adder 98 performs an addition operation of a second preset vector length based on the shifted first product, the shifted second difference, and the second product to obtain a target sum. Output selector 99 includes a first input, a second input, and a third input. The first input of output selector 99 is connected to the first multiplier 91, the second input is connected to the second multiplier 92, and the third input is connected to the third adder 98. Output selector 99 is used to receive mode setting information (which can be issued by the circuit control unit), and when the mode setting information indicates that the current operating mode is the first module, it selects to output the target sum; when the mode setting information indicates that the current operating mode is the second module, it selects to output the first product and the second product.

[0097] It should be understood that in the first module operating mode, the first input and the second input are the high-order and low-order portions of the first operand, respectively. The third input and the fourth input are the high-order and low-order portions of the second operand, respectively. In this mode, a bit-width configurable multiplier is used to calculate the product of the first operand and the second operand. Both the first operand and the second operand are of a first preset vector length (e.g., 64 bits). In the second module operating mode, the first input and the third input are the first operand and the second operand, respectively, and the second input and the fourth input are the third operand and the fourth operand, respectively. In this mode, a bit-width configurable multiplier is used to calculate the product of the first operand and the second operand and the product of the third operand and the fourth operand in parallel. The first operand, the second operand, the third operand, and the fourth operand are all of a second preset vector length (e.g., 32 bits).

[0098] Specifically, in Figure 9 In the configurable bit-width multiplier shown, when in the first module working mode, the first operand is split into a first input Xh of the high-order part and a second input Xl of the low-order part according to the bit width, and the second operand is split into a third input Yh of the high-order part and a fourth input Yl of the low-order part according to the bit width.

[0099] First, the first input Xh and the third input Yh are input to the first multiplier 91, and the second input Xl and the fourth input Yl are input to the second multiplier 92. The first multiplier 91 can perform a multiplication operation with a second preset vector length based on the first input Xh and the third input Yh to obtain a first product A. The second multiplier 92 can perform a multiplication operation with a second preset vector length based on the second input Xl and the fourth input Yl to obtain a second product B.

[0100] Simultaneously, the first input Xh and the second input Xl are input to the first adder 93, and the third input Yh and the fourth input Yl are input to the second adder 94. The first adder 93 can perform addition operations based on the first input Xh and the second input Xl for a second preset vector length to obtain a first sum C. The second adder 94 is used to perform addition operations based on the third input Yh and the fourth input Yl for a second preset vector length to obtain a second sum D. The first sum C and the second sum D are input to the third multiplier 95. The third multiplier 95 can perform multiplication operations based on the first sum C and the second sum D for a second preset vector length to obtain a third product E.

[0101] Subsequently, the third product E and the first product A can be input into the first subtractor 96. The first subtractor 96 can perform a subtraction operation of a second preset vector length based on the third product E and the first product A to obtain a first difference F. The first difference F and the second product B can be input into the second subtractor 97. The second subtractor 97 can perform a subtraction operation of a second preset vector length based on the first difference F and the second product B to obtain a second difference G.

[0102] Finally, the second difference G, the first product A, and the second product B are input to the third adder 98. The third adder 98 performs an addition operation of a second preset vector length based on the shifted first product A (obtained by shifting module 911 by shifting the first product A, the specific shift number being determined based on the bit width of the first and second operands), the shifted second difference G (obtained by shifting module 910 by shifting the second difference G, the specific shift number being determined based on the bit width of the first and second operands), and the second product B to obtain the target sum H. The target sum H is the product of the first operand and the second operand, both having a first preset vector length. This target sum H is then output as the final result by the output selector 99 after the input / output selector 99.

[0103] And, in Figure 9In the bit-width configurable multiplier shown, when in the second module working mode, the first operand and the second operand can be used as the first input Xh and the third input Yh, and the third operand and the fourth operand can be used as the second input Xl and the fourth input Yl.

[0104] Furthermore, the first input Xh and the third input Yh are input to the first multiplier 91, and the second input Xl and the fourth input Yl are input to the second multiplier 92. The first multiplier 91 can perform a multiplication operation with a second preset vector length based on the first input Xh and the third input Yh to obtain a first product A. The second multiplier 92 can perform a multiplication operation with a second preset vector length based on the second input Xl and the fourth input Yl to obtain a second product B. The first product A is the product of the first operand and the second operand, both with a second preset vector length. The first product B is the product of the third operand and the fourth operand, both with a second preset vector length. The first product A and the second product B are output as the final result by the output selector 99 after the input-output selector 99.

[0105] Therefore, by employing the aforementioned computing units to implement the number-theory transformation circuit, this embodiment of the invention enables the number-theory transformation circuit to support polynomial number-theory transformations with coefficient bit widths of 36 and 64. Furthermore, by enabling the number-theory transformation circuit to support polynomial number-theory transformations with coefficient bit widths of 36 and 64, this embodiment of the invention can further support polynomial number-theory transformations with coefficient bit widths of 36 or 45, etc., by employing bit padding (i.e., adjusting the coefficient bit width to 36 or 64 bits by adding zero bits). It should also be noted that the control of the bit width that each computing unit can handle can also be implemented by the circuit control unit, and this application does not impose any limitations on this.

[0106] Figure 10 This is a schematic diagram of a circuit control method according to an embodiment of the present invention. It should be understood that... Figure 10 The executing entity of the circuit control method shown can be the circuit control unit in the above embodiments. By executing... Figure 10 The circuit control method shown allows the circuit control unit to control each circuit unit within the number-theoretical transformation circuit to implement the number-theoretical transformation process for polynomials with varying numbers of coefficients, thus ensuring compatibility with the computational requirements of different fully homomorphic encryption schemes. For example... Figure 10 As shown, the circuit control method may specifically include the following steps: Step S100: Receive at least one polynomial to be processed.

[0107] Specifically, the circuit control unit can receive at least one polynomial to be processed. The polynomial to be processed can refer to a polynomial that requires number theory transformation processing.

[0108] Step S200: Adjust the unit working mode of the first frequency domain decimation unit according to the number of coefficients of the polynomial to be processed, and perform number theory transformation on the polynomial to be processed through the multiple domain decimation units and the corresponding inter-level connection transformation units.

[0109] Specifically, upon receiving the polynomial to be processed, the circuit control unit can first adjust the unit operating mode of the first frequency domain decimation unit according to the number of coefficients of the polynomial, and then perform number theory transformation on the polynomial through multiple domain decimation units and corresponding inter-stage transition units. It should be understood that in this embodiment of the invention, the first frequency domain decimation unit is implemented using a mixed basis decomposition method. The first frequency domain decimation unit has different unit operating modes, and the first frequency domain decimation units in different unit operating modes are respectively used to perform frequency domain decimation on coefficient vector sequences with different sequence lengths.

[0110] Optionally, in step S200, if the number of coefficients of the polynomial to be processed is detected to meet the first preset number of coefficients, the circuit control unit can adjust the unit operating mode of the first frequency domain decimation unit to the first unit operating mode, and then perform number theory transformation on the polynomial to be processed through multiple domain decimation units and corresponding inter-stage connection transformation units. If the number of coefficients of the polynomial to be processed is detected to meet the second preset number of coefficients, the circuit control unit can adjust the unit operating mode of the first frequency domain decimation unit to the second unit operating mode, and then perform number theory transformation on the polynomial to be processed through multiple domain decimation units and corresponding inter-stage connection transformation units.

[0111] It should be noted that the first preset number of coefficients, the second preset number of coefficients, the transformation length of the first frequency domain decimation unit between the first unit working mode and the second unit working mode (i.e., the sequence length of the coefficient vector sequence that can be processed), and the transformation length of the time-domain and frequency-domain decimation units can be set by relevant personnel based on actual number theory transformation needs, and this application does not impose any restrictions on this. Indicatively, as one setting method, the first preset number of coefficients can be set to 1024, and the second preset number of coefficients can be set to 2048. Correspondingly, to perform number theory transformations on polynomials to be processed with 1024 and 2048 coefficients, the processing time-domain decimation unit can be set to perform time-domain decimation on a coefficient vector sequence with a sequence length of 32, the first frequency domain decimation unit in the first unit working mode can be set to perform frequency-domain decimation on a coefficient vector sequence with a sequence length of 32, and the first frequency domain decimation unit in the second unit working mode can be set to perform frequency-domain decimation on a coefficient vector sequence with a sequence length of 64.

[0112] Optionally, to support number-theoretical transformations of polynomials with a larger number of coefficients (polynomials with a larger number of coefficients need to be transformed into coefficient vector matrices with more dimensions for processing), the frequency domain decimation unit may further include a second frequency domain decimation unit and a third frequency domain decimation unit. In this case, in step S200, the circuit control unit can enable the corresponding frequency domain decimation unit according to the number of coefficients of the polynomial to be processed, adjust the unit operating mode of the first frequency domain decimation unit, and then perform number-theoretical transformations on the polynomial to be processed through multiple domain decimation units and corresponding inter-stage connection transformation units.

[0113] Specifically, in this implementation, if the number of coefficients of the polynomial to be processed is detected to meet a first preset number of coefficients, the circuit control unit enables the time-domain decimation unit and the first frequency-domain decimation unit, and adjusts the unit operating mode of the first frequency-domain decimation unit to the first unit operating mode. Then, number theory transformation is performed on the polynomial to be processed through multiple domain decimation units and corresponding inter-stage connection transformation units. If the number of coefficients of the polynomial to be processed is detected to meet a second preset number of coefficients, the circuit control unit enables the time-domain decimation unit and the first frequency-domain decimation unit, and adjusts the unit operating mode of the first frequency-domain decimation unit to the second unit operating mode. Then, number theory transformation is performed on the polynomial to be processed through multiple domain decimation units and corresponding inter-stage connection transformation units. If the number of coefficients of the polynomial to be processed is detected to meet the third preset number of coefficients, the circuit control unit can enable the time domain decimation unit, the frequency domain decimation unit, the second frequency domain decimation unit and the third frequency domain decimation unit, and adjust the unit working mode of the first frequency domain decimation unit to the second unit working mode, and then perform number theory transformation on the polynomial to be processed through multiple domain decimation units and corresponding inter-level connection transformation units.

[0114] It should be noted that the number of preset coefficients, like the number of the second and third frequency domain decimation units, can be set by relevant personnel based on actual number theory transformation needs, and this application does not impose any restrictions on this. Illustratively, as one setting, the number of preset coefficients is 65536. Correspondingly, to perform number theory transformation on a polynomial with 65536 coefficients, the second frequency domain decimation unit can be set to perform time-domain decimation on a coefficient vector sequence of length 16, and the third frequency domain decimation unit can be set to perform time-domain decimation on a coefficient vector sequence of length 2.

[0115] Optionally, to support the implementation of the first unit operating mode and the second unit operating mode described above, as one implementation, the first frequency domain decimation unit can be configured to include 32 2-point sub-frequency domain decimation units and 2 32-point sub-frequency domain decimation units. In this implementation, the circuit control unit specifically enables the 2 32-point sub-frequency domain decimation units to adjust the unit operating mode of the first frequency domain decimation unit to the first unit operating mode. Alternatively, the circuit control unit specifically enables the 32 2-point sub-frequency domain decimation units and the 2 32-point sub-frequency domain decimation units to adjust the unit operating mode of the first frequency domain decimation unit to the second unit operating mode.

[0116] Alternatively, as one implementation, the circuit control unit can also be configured to set the bit width that each computational unit in the circuit can process according to the bit width of the polynomial to be processed, and this application does not limit this.

[0117] Optionally, to enable the number-theory transform circuit to perform pipelined processing of multiple polynomials, the time-domain decimation unit and the first inter-stage connection conversion unit can be configured as a multi-stage parallel structure. That is, the time-domain decimation unit can also be configured to include multiple parallel sub-time-domain decimation units, and the first inter-stage connection conversion unit can be configured to include multiple parallel rotation factor modular multiplication modules and transpose modules. It should be understood that the number of sub-time-domain decimation units included in the time-domain decimation unit and the number of rotation factor modular multiplication modules and transpose modules included in the first inter-stage connection conversion unit can be set according to the processing capability of the subsequent frequency-domain decimation units of the number-theory transform circuit, and this application does not impose any limitations on this.

[0118] Furthermore, as a compatible data input method, when multiple polynomials to be processed are detected, the circuit control unit can determine the polynomial coefficient vector matrix corresponding to each polynomial to be processed, and based on a preset time interval, input the polynomial coefficient vector matrices corresponding to the multiple polynomials to be processed into multiple domain extraction units and corresponding inter-level transition transformation units, so as to perform number theory transformations on the polynomials to be processed through the multiple domain extraction units and corresponding inter-level transition transformation units. The preset time interval can also be set according to the data application, and this application does not impose any restrictions on it.

[0119] Schematic, as one configuration, the time-domain decimation unit can be configured to include two parallel 32-point sub-time-domain decimation units. The first inter-stage transition unit can be configured to include two rotation factor modular multiplication modules and three transpose modules. Furthermore, the preset time interval can be set to 32 clock cycles.

[0120] Figures 11 to 18 This is a schematic diagram of the number theory transformation process according to an embodiment of the present invention. It should be understood that... Figures 11 to 18The content shown can be the number theory transformation process of the number theory transformation circuit for 6 polynomials to be processed (2048 coefficients, unlimited coefficient width) when the time domain decimation unit is set to include two parallel 32-point sub-time domain decimation units, the first inter-stage connection transformation unit is set to include two rotation factor modular multiplication modules and three transpose modules, and the preset time interval is set to 32 clock cycles.

[0121] First, for the six polynomials to be processed, the circuit control unit can convert them into polynomial coefficient vector matrices A, B, C, D, E and F, which are 32×64 respectively.

[0122] Furthermore, such as Figure 11 As shown, in the first processing cycle, the circuit control unit can begin inputting the polynomial coefficient vector matrix A into the number theory transform circuit. It should be understood that after the polynomial coefficient vector matrix A is initially input into the 32-point sub-time domain decimation unit 1111, the 32-point sub-time domain decimation unit 1111 will perform time domain decimation on the coefficient vector sequence of length 32 in each clock cycle, completing the time domain decimation processing of the polynomial coefficient vector matrix A within 64 clock cycles. The output of the 32-point sub-time domain decimation unit 1111 in each clock cycle can be processed by the rotation factor modular multiplication module 1121 and input into the transpose module 1131. The transpose module 1131 can temporarily store the data. After the entire polynomial coefficient vector matrix A is completely stored, the transpose module 1131 can perform transpose processing on the polynomial coefficient vector matrix A. The transposed polynomial coefficient vector matrix A is then input into the 64-point frequency domain decimation unit 1141. The 64-point frequency domain decimation unit 1141 performs time-domain decimation on the 64-bit coefficient vector sequence to complete the frequency-domain decimation processing of the polynomial coefficient vector matrix A within 32 clock cycles. Thus, the polynomial to be processed corresponding to the polynomial coefficient vector matrix A can be transformed from the time domain to the frequency domain.

[0123] In the second processing cycle, such as Figure 12As shown, the circuit control unit can start inputting the polynomial coefficient vector matrix B into the number theory transform circuit while maintaining the input polynomial coefficient vector matrix A. It should be understood that after the polynomial coefficient vector matrix B is initially input into the 32-point sub-time domain decimation unit 1112, the 32-point sub-time domain decimation unit 1112 will perform time domain decimation on the coefficient vector sequence of length 32, completing the time domain decimation processing of the polynomial coefficient vector matrix B within 64 clock cycles. For the output result of the 32-point sub-time domain decimation unit 1112 in each clock cycle, the rotation factor modular multiplication module 1122 can perform rotation factor modular multiplication on it and input it into the transpose module 1132. The transpose module 1132 can temporarily store the data. After the entire polynomial coefficient vector matrix B is completely stored, the transpose module 1132 can perform transpose processing on the polynomial coefficient vector matrix B. The transposed polynomial coefficient vector matrix B is then input to the 64-point frequency domain decimation unit 1142. The 64-point frequency domain decimation unit 1142 performs time-domain decimation on the 64-bit coefficient vector sequence, completing the frequency-domain decimation processing of the polynomial coefficient vector matrix B within 32 clock cycles. Thus, the polynomial to be processed corresponding to the polynomial coefficient vector matrix B can be transformed from the time domain to the frequency domain.

[0124] In the third processing cycle, such as Figure 13As shown, since the entire polynomial coefficient vector matrix A has been completely stored in the transpose module 1131, the transpose module 1131 can transpose the polynomial coefficient vector matrix A. The transposed polynomial coefficient vector matrix A will then be input to the 64-point frequency domain decimation unit 1141, so that the 64-point frequency domain decimation unit 1141 can complete the frequency domain decimation processing of the polynomial coefficient vector matrix A within 32 clock cycles. Simultaneously, the circuit control unit can start inputting the polynomial coefficient vector matrix C to the number theory transform circuit while maintaining the input polynomial coefficient vector matrix B. It should be understood that after the polynomial coefficient vector matrix C is input to the 32-point sub-time domain decimation unit 1111, the 32-point sub-time domain decimation unit 1111 will perform time domain decimation on the coefficient vector sequence of length 32, so as to complete the time domain decimation processing of the polynomial coefficient vector matrix C within 64 clock cycles. For the output of the 32-point sub-time domain decimation unit 1111 in each clock cycle, the rotation factor modular multiplication module 1122 can perform rotation factor modular multiplication on it and input it into the transpose module 1133 (both transpose modules 1131 and 1132 are occupied). The transpose module 1133 can temporarily store the data. After the entire polynomial coefficient vector matrix C is completely stored, the transpose module 1133 can transpose the polynomial coefficient vector matrix C. The transposed polynomial coefficient vector matrix C will then be input into the 64-point frequency domain decimation unit 1142. The 64-point frequency domain decimation unit 1142 will perform time domain decimation on the coefficient vector sequence with a sequence length of 64 to complete the frequency domain decimation processing of the polynomial coefficient vector matrix C within 32 clock cycles. Thus, the polynomial to be processed corresponding to the polynomial coefficient vector matrix C can be transformed from the time domain to the frequency domain.

[0125] In the fourth processing cycle, such as Figure 14 As shown, since the entire polynomial coefficient vector matrix B has been completely stored in the transpose module 1132, the transpose module 1132 can transpose the polynomial coefficient vector matrix B. The transposed polynomial coefficient vector matrix B is then input to the 64-point frequency domain decimation unit 1141, which completes the frequency domain decimation of the polynomial coefficient vector matrix B within 32 clock cycles. Simultaneously, the circuit control unit can begin inputting the polynomial coefficient vector matrix D to the number theory transform circuit while maintaining the input polynomial coefficient vector matrix C. It should be understood that the processing of the polynomial coefficient vector matrix D can be described above and will not be repeated here.

[0126] In the fifth processing cycle, such as Figure 15As shown, since the entire polynomial coefficient vector matrix C has been completely stored in the transpose module 1133, the transpose module 1133 can transpose the polynomial coefficient vector matrix C. The transposed polynomial coefficient vector matrix C is then input to the 64-point frequency domain decimation unit 1141, so that the 64-point frequency domain decimation unit 1141 can complete the frequency domain decimation processing of the polynomial coefficient vector matrix C within 32 clock cycles. Simultaneously, the circuit control unit can start inputting the polynomial coefficient vector matrix E to the number theory transform circuit while maintaining the input polynomial coefficient vector matrix D. It should be understood that the processing of the polynomial coefficient vector matrix E can be described with reference to the parameters above, and will not be repeated here.

[0127] In the sixth processing cycle, such as Figure 16 As shown, since the entire polynomial coefficient vector matrix D has been completely stored in the transpose module 1131, the transpose module 1131 can transpose the polynomial coefficient vector matrix D. The transposed polynomial coefficient vector matrix D will then be input to the 64-point frequency domain decimation unit 1141, so that the 64-point frequency domain decimation unit 1141 can complete the frequency domain decimation processing of the polynomial coefficient vector matrix D within 32 clock cycles. Simultaneously, the circuit control unit can start inputting the polynomial coefficient vector matrix F to the number theory transform circuit while maintaining the input polynomial coefficient vector matrix E. It should be understood that the processing procedure for the polynomial coefficient vector matrix F can be described with reference to the parameters above, and will not be repeated here.

[0128] During the seventh processing cycle, such as Figure 17 As shown, since the entire polynomial coefficient vector matrix E has been completely stored in the transpose module 1132, the transpose module 1132 can transpose the polynomial coefficient vector matrix E. The transposed polynomial coefficient vector matrix E is then input to the 64-point frequency domain decimation unit 1141, so that the 64-point frequency domain decimation unit 1141 can complete the frequency domain decimation processing of the polynomial coefficient vector matrix E within 32 clock cycles. Simultaneously, since all polynomial coefficient vector matrices have been processed, the circuit control unit can maintain only the input polynomial coefficient vector matrix F.

[0129] During the eighth processing cycle, such as Figure 18As shown, since the entire polynomial coefficient vector matrix F has been completely stored in the transpose module 1133, the transpose module 1133 can transpose the polynomial coefficient vector matrix F. The transposed polynomial coefficient vector matrix F is then input to the 64-point frequency domain decimation unit 1141, which completes the frequency domain decimation of the polynomial coefficient vector matrix F within 32 clock cycles. Therefore, the number-theory transform circuit can pipeline the number-theory transform processing of polynomial coefficient vector matrices A, B, C, D, E, and F, thereby improving the efficiency of the number-theory transform.

[0130] This invention embodiment configures the number-theory transform circuit to include both a time-domain decimation unit and a frequency-domain decimation unit. A hybrid basis decomposition method is used to implement the first frequency-domain decimation unit. Furthermore, the first frequency-domain decimation unit is configured to perform frequency-domain decimation on coefficient vector sequences with different sequence lengths under different operating modes. The operating mode of the first frequency-domain decimation unit is adjusted according to the number of coefficients in the polynomial to be processed. Therefore, this invention embodiment can simultaneously support number-theory transforms for polynomials with various numbers of coefficients without increasing hardware costs, thus being compatible with the computational requirements of different fully homomorphic encryption schemes.

[0131] Figure 19 This is a schematic diagram of the circuit control device according to an embodiment of the present invention. Figure 19 As shown, the circuit control device of this embodiment includes a receiving unit 191 and an execution unit 192.

[0132] Specifically, the receiving unit 191 is used to receive at least one polynomial to be processed.

[0133] The execution unit 192 is used to adjust the unit operating mode of the first frequency domain decimation unit according to the number of coefficients of the polynomial to be processed, and to perform number theory transformation on the polynomial to be processed through multiple domain decimation units and corresponding inter-level connection transformation units. The multiple domain decimation units include a time domain decimation unit and at least one frequency domain decimation unit. The frequency domain decimation unit includes at least a first frequency domain decimation unit. The first frequency domain decimation unit is implemented by mixed basis decomposition. The first frequency domain decimation unit has different unit operating modes. The first frequency domain decimation units in different unit operating modes are respectively used to perform frequency domain decimation on coefficient vector sequences with different sequence lengths. The inter-level connection transformation unit is set between each of the domain decimation units. The inter-level connection transformation unit is used to perform inter-level connection transformation processing.

[0134] This invention embodiment configures the number-theory transform circuit to include both a time-domain decimation unit and a frequency-domain decimation unit. A hybrid basis decomposition method is used to implement the first frequency-domain decimation unit. Furthermore, the first frequency-domain decimation unit is configured to perform frequency-domain decimation on coefficient vector sequences with different sequence lengths under different operating modes. The operating mode of the first frequency-domain decimation unit is adjusted according to the number of coefficients in the polynomial to be processed. Therefore, this invention embodiment can simultaneously support number-theory transforms for polynomials with various numbers of coefficients without increasing hardware costs, thus being compatible with the computational requirements of different fully homomorphic encryption schemes.

[0135] Figure 20 This is a schematic diagram of the circuit control unit according to an embodiment of the present invention. Figure 20 As shown, the circuit control unit includes at least one processor 201 and a memory 202 communicatively connected to at least one processor 201; wherein the memory 202 stores instructions executable by at least one processor 201 to implement the circuit control method described above.

[0136] Specifically, the electronic device includes: one or more processors 201 and a memory 202. Figure 20 Taking a processor 201 as an example, the processor 201 and the memory 202 can be connected via a bus or other means. Figure 20 Taking a bus connection as an example, memory 202, as a non-volatile computer-readable storage medium, can be used to store non-volatile software programs, non-volatile computer-executable programs, and modules. Processor 201 executes various functional applications and data processing of the device by running the non-volatile software programs, instructions, and modules stored in memory 202, thereby implementing the aforementioned circuit control method.

[0137] The memory 202 may include a program storage area and a data storage area. The program storage area may store the operating system and an application program required for at least one function; the data storage area may store an option list, etc. In addition, the memory 202 may include high-speed random access memory, and may also include non-volatile memory, such as at least one disk storage device, flash memory device, or other non-volatile solid-state storage device.

[0138] One or more modules are stored in memory 202 and, when executed by one or more processors 201, execute the circuit control method in any of the above method embodiments.

[0139] The above-mentioned products can perform the methods provided in the embodiments of this application, and have the corresponding functional modules and beneficial effects of performing the methods. For technical details not described in detail in this embodiment, please refer to the methods provided in the embodiments of this application.

[0140] This invention embodiment configures the number-theory transform circuit to include both a time-domain decimation unit and a frequency-domain decimation unit. A hybrid basis decomposition method is used to implement the first frequency-domain decimation unit. Furthermore, the first frequency-domain decimation unit is configured to perform frequency-domain decimation on coefficient vector sequences with different sequence lengths under different operating modes. The operating mode of the first frequency-domain decimation unit is adjusted according to the number of coefficients in the polynomial to be processed. Therefore, this invention embodiment can simultaneously support number-theory transforms for polynomials with various numbers of coefficients without increasing hardware costs, thus being compatible with the computational requirements of different fully homomorphic encryption schemes.

[0141] Another embodiment of the present invention relates to a non-volatile storage medium for storing a computer-readable program for use by a computer to execute some or all of the above-described method embodiments.

[0142] That is, those skilled in the art will understand that all or part of the steps in the methods of the above embodiments can be implemented by a program instructing related hardware. This program is stored in a storage medium and includes several instructions to cause a device (which may be a microcontroller, chip, etc.) or processor to execute all or part of the steps of the methods described in the embodiments of this application. The aforementioned storage medium includes various media capable of storing program code, such as a USB flash drive, a portable hard drive, a read-only memory (ROM), a random access memory (RAM), a magnetic disk, or an optical disk.

[0143] The above description is merely a preferred embodiment of this application and is not intended to limit this application. Various modifications and variations can be made to this application by those skilled in the art. Any modifications, equivalent substitutions, improvements, etc., made within the spirit and principles of this application should be included within the protection scope of this application.

Claims

1. A number-theory transform circuit, characterized in that, The number theory transformation circuit includes: Multiple domain extraction units, wherein the multiple domain extraction units include a time-domain extraction unit and at least one frequency-domain extraction unit, the frequency-domain extraction unit includes at least a first frequency-domain extraction unit, the first frequency-domain extraction unit is implemented by a mixed basis decomposition method, the first frequency-domain extraction unit has different unit operating modes, and the first frequency-domain extraction units in different unit operating modes are respectively used to perform frequency-domain extraction on coefficient vector sequences with different sequence lengths. At least one inter-level connection conversion unit is provided, which is disposed between each of the domain extraction units, and the inter-level connection conversion unit is used to perform inter-level connection conversion processing. The circuit control unit is configured to perform the following steps: Receive at least one polynomial to be processed; The unit operating mode of the first frequency domain decimation unit is adjusted according to the number of coefficients of the polynomial to be processed, and the polynomial to be processed is subjected to number theory transformation through the multiple domain decimation units and the corresponding inter-level connection transformation units.

2. The number-theory transform circuit according to claim 1, characterized in that, The first frequency domain decimation unit has two operating modes: a first operating mode and a second operating mode. The circuit control unit is specifically configured as follows: In response to detecting that the number of coefficients of the polynomial to be processed meets the first preset number of coefficients, the unit working mode of the first frequency domain extraction unit is adjusted to the first unit working mode, and the polynomial to be processed is subjected to number theory transformation through the multiple domain extraction units and the corresponding inter-level connection transformation units; In response to detecting that the number of coefficients of the polynomial to be processed meets the second preset number of coefficients, the unit working mode of the first frequency domain decimation unit is adjusted to the second unit working mode, and the polynomial to be processed is subjected to number theory transformation through the multiple domain decimation units and the corresponding inter-level connection transformation units.

3. The number-theory transformation circuit according to claim 2, characterized in that, The frequency domain decimation unit further includes a second frequency domain decimation unit and a third frequency domain decimation unit; The circuit control unit is specifically configured as follows: Enable the corresponding frequency domain decimation unit according to the number of coefficients of the polynomial to be processed, and adjust the unit working mode of the first frequency domain decimation unit. Perform number theory transformation on the polynomial to be processed through the multiple domain decimation units and the corresponding inter-level connection transformation units.

4. The number-theory transformation circuit according to claim 3, characterized in that, The first frequency domain decimation unit has two operating modes: a first operating mode and a second operating mode. In response to detecting that the number of coefficients of the polynomial to be processed meets the first preset number of coefficients, the time domain decimation unit and the first frequency domain decimation unit are enabled, and the unit working mode of the first frequency domain decimation unit is adjusted to the first unit working mode. The polynomial to be processed is subjected to number theory transformation through the multiple domain decimation units and the corresponding inter-level connection transformation units. In response to detecting that the number of coefficients of the polynomial to be processed meets the second preset number of coefficients, the time domain decimation unit and the first frequency domain decimation unit are enabled, and the unit working mode of the first frequency domain decimation unit is adjusted to the second unit working mode. The polynomial to be processed is subjected to number theory transformation through the multiple domain decimation units and the corresponding inter-level connection transformation units. In response to detecting that the number of coefficients of the polynomial to be processed meets the third preset number of coefficients, the time domain decimation unit, the frequency domain decimation unit, the second frequency domain decimation unit, and the third frequency domain decimation unit are enabled, and the unit working mode of the first frequency domain decimation unit is adjusted to the second unit working mode. The polynomial to be processed is then subjected to number theory transformation through the multiple domain decimation units and the corresponding inter-level connection transformation units.

5. The number-theory transformation circuit according to claim 4, characterized in that, The first preset number of coefficients is 1024, the second preset number of coefficients is 2048, the time-domain decimation unit is used to perform time-domain decimation on a coefficient vector sequence with a sequence length of 32, the first frequency-domain decimation unit in the first unit working mode is used to perform frequency-domain decimation on a coefficient vector sequence with a sequence length of 32, the first frequency-domain decimation unit in the second unit working mode is used to perform frequency-domain decimation on a coefficient vector sequence with a sequence length of 64, the third preset number of coefficients is 65536, the second frequency-domain decimation unit is used to perform time-domain decimation on a coefficient vector sequence with a sequence length of 16, and the third frequency-domain decimation unit is used to perform time-domain decimation on a coefficient vector sequence with a sequence length of 2.

6. The number-theory transformation circuit according to claim 2 or 4, characterized in that, The first frequency domain decimation unit includes multiple sub-frequency domain decimation units with different transform lengths. The circuit control unit is specifically configured as follows: Enable the corresponding sub-frequency domain decimation units within the first frequency domain decimation unit to adjust the unit operating mode of the first frequency domain decimation unit to the first unit operating mode, or adjust the unit operating mode of the first frequency domain decimation unit to the second unit operating mode.

7. The number-theory transform circuit according to claim 1, characterized in that, The circuit control unit is specifically configured as follows: In response to detecting that there are multiple received polynomials to be processed, a polynomial coefficient vector matrix corresponding to each of the polynomials to be processed is determined; Based on a preset time interval, the polynomial coefficient vector matrix corresponding to the plurality of polynomials to be processed is input into the plurality of domain extraction units and the corresponding inter-level connection transformation units, so as to perform number theory transformation on the polynomials to be processed through the plurality of domain extraction units and the corresponding inter-level connection transformation units.

8. The number-theory transform circuit according to claim 1, characterized in that, The time-domain decimation unit is implemented using a time-domain decimation butterfly module, and each of the frequency-domain decimation units is implemented using a frequency-domain decimation butterfly module. The time-domain decimation butterfly module and the frequency-domain decimation butterfly module have different module operating modes. The time-domain decimation butterfly module in different module operating modes is used to perform time-domain decimation butterfly operations on polynomial coefficient vectors with different vector lengths, and the frequency-domain decimation butterfly module in different module operating modes is used to perform frequency-domain decimation butterfly operations on polynomial coefficient vectors with different vector lengths.

9. The number-theory transform circuit according to claim 8, characterized in that, The module's operating modes include a first module operating mode and a second module operating mode; Both the time-domain decimation butterfly module and the frequency-domain decimation butterfly module include a bit-width configurable modular multiplier, a bit-width configurable modular adder, and a bit-width configurable modular subtractor. In the first module's operating mode, the bit-width configurable modular multiplier is configured to perform modular multiplication of a first preset vector length, the bit-width configurable modular adder is configured to perform modular addition of the first preset vector length, and the bit-width configurable modular subtractor is configured to perform modular subtraction of the first preset vector length. In the second module's operating mode, the bit-width configurable modular multiplier is configured to perform modular multiplication of a second preset vector length in parallel, the bit-width configurable modular adder is configured to perform modular addition of the second preset vector length in parallel, and the bit-width configurable modular subtractor is configured to perform modular subtraction of the second preset vector length.

10. The number-theory transformation circuit according to claim 9, characterized in that, The bit-width configurable modular multiplier includes: The first configurable multiplier is used to perform a multiplication operation of the first preset vector length based on the input data, or to perform two multiplication operations of the second preset vector length in parallel to obtain the original multiplication result; The first shift unit is used to perform a shift operation based on the original multiplication result to obtain the high-order truncation value; The second bit-width configurable multiplier is used to perform a multiplication operation of the first preset vector length based on the high-bit truncation value and the pre-calculated value, or to perform two multiplication operations of the second preset vector length in parallel to obtain the corresponding intermediate result. The second shift unit is used to perform a shift operation based on the intermediate result to obtain an approximate quotient value; A third bit-width configurable multiplier is used to perform a multiplication operation of the first preset vector length based on the quotient approximation and the target modulus, or to perform two multiplication operations of the second preset vector length in parallel to obtain the subtractive value. The first subtractor is used to perform a subtraction operation based on the value to be subtracted and the original multiplication result to obtain the value to be reduced. The first correction circuit is used to select, based on the comparison result between the value to be reduced and the target modulus, to output the value to be reduced as the first reduction result, or to output the difference between the value to be reduced and the target modulus as the first reduction result. The second correction circuit is used to select, based on the comparison result between the first reduction result and the target modulus, whether to output the first reduction result as the second reduction result or to output the difference between the first reduction result and the target modulus as the second reduction result.

11. The number-theory transformation circuit according to claim 10, characterized in that, The bit-width configurable multiplier includes: The first multiplier is used to perform a multiplication operation of the second preset vector length based on the first input and the third input to obtain the first product; The second multiplier is used to perform a multiplication operation based on the second input and the fourth input, with the second preset vector length, to obtain the second product; The first adder is used to perform an addition operation of the second preset vector length based on the first input and the second input to obtain a first sum; The second adder is used to perform an addition operation based on the third input and the fourth input, with the length of the second preset vector, to obtain the second sum. The third multiplier is used to perform a multiplication operation of the second preset vector length based on the first sum and the second sum to obtain the third product; The first subtractor is used to perform a subtraction operation on the second preset vector length based on the third product and the first product to obtain a first difference; The second subtractor is used to perform a subtraction operation on the second preset vector length based on the first difference and the second product to obtain the second difference; The third adder is used to perform an addition operation of the second preset vector length based on the shifted first product, the shifted second difference, and the second product, so as to obtain the target sum. An output selector is provided, wherein a first input terminal of the output selector is connected to the first multiplier, a second input terminal is connected to the second multiplier, and a third input terminal is connected to the third adder. The output selector is used to receive mode setting information. In response to the mode setting information indicating that it is currently in a first module working mode, the output selector selects to output the target sum. In response to the mode setting information indicating that it is currently in a second module working mode, the output selector selects to output the first product and the second product. In the first module working mode, the first input and the second input are respectively the high-order part and the low-order part of the first operand, and the third input and the fourth input are respectively the high-order part and the low-order part of the second operand. In the second module working mode, the first input and the second input are respectively the first operand and the second operand, and the third input and the fourth input are respectively the third operand and the fourth operand.

12. The number-theory transform circuit according to claim 1, characterized in that, The inter-level connection conversion unit includes a rotation factor modular multiplication module and a transpose module.

13. A circuit control method, characterized in that, The method is applicable to number-theory transform circuits, and the method includes: Receive at least one polynomial to be processed; The unit operating mode of the first frequency domain decimation unit is adjusted according to the number of coefficients of the polynomial to be processed. The polynomial to be processed is subjected to number theory transformation through multiple domain decimation units and corresponding inter-level connection transformation units. The multiple domain decimation units include a time domain decimation unit and at least one frequency domain decimation unit. The frequency domain decimation unit includes at least a first frequency domain decimation unit. The first frequency domain decimation unit is implemented by mixed basis decomposition. The first frequency domain decimation unit has different unit operating modes. The first frequency domain decimation units in different unit operating modes are used to perform frequency domain decimation on coefficient vector sequences with different sequence lengths. The inter-level connection transformation units are set between each of the domain decimation units. The inter-level connection transformation units are used to perform inter-level connection transformation processing.

14. A hardware accelerator, characterized in that, The hardware accelerator includes: The number theory transformation circuit as described in any one of claims 1-12.