COMPUTING DEVICE FOR PERFORMING TRANSFORMING COMPUTATION

A computing device for performing a transforming computation, includes stage computations with odd stage computations and even stage computations. The computing device includes the following elements. A stage computing circuit, repeatedly used to perform several butterfly computations of each stage computation, includes butterfly computation circuits for performing butterfly computations of each stage computation according to weight coefficients and input data to generate a stage computation result. A sorting circuit, is repeatedly used to sort the input data or the stage computation result of each stage computation to generate a sorting result. A first memory, stores the input data of a first stage computation and the stage computing result of each even stage computation or the sorting result of each even stage computation. And, a second memory, stores the stage computation result of each odd stage computation or the sorting result of each odd stage computation.

Skip to: Description  ·  Claims  · Patent History  ·  Patent History
Description

This application claims the benefit of U.S. provisional application Ser. No. 63/535,599, filed Aug. 31, 2023, the disclosure of which is incorporated by reference herein in its entirety.

TECHNICAL FIELD

The present disclosure relates to a computing device; in particular, relates to a computing device for performing transforming computation(s). The computing device sorts stage computation results of the transforming computation(s), and utilizes a ping-pong memory mechanism to store the stage computation results and the sorting results in an interleaved manner.

BACKGROUND

With the development of big data analysis technology and artificial intelligence technology, various forms of information are widely exchanged around the world and aspects of the society, thus raising concerns about information leakage. In order to meet the requirements of information security, information encryption mechanism is a necessary solution. However, the encryption of information may be cracked by a malicious third party through quantum technology (referred to as “quantum decryption”). In order to resist quantum decryption, research units have developed post-quantum crypto systems based on post-quantum cryptography (PQC). Among the many implementations of the post-quantum crypto systems, the lattice-based crypto system have a better rating on its overall performance and are therefore widely used. The lattice-based crypto system includes, for example, a “CRYSTALS-Kyber” system and a “Dilithium” system, etc.

The computing mechanism of the lattice-based crypto system uses a large number of polynomial multiplication computations. Polynomial multiplication computations are usually implemented by number theoretic transforming computations (NTT) and inverse number theoretic transforming computations (INTT). However, the NTT and INTT are highly complex and consume a lot of computing time, which greatly reduces the overall computing efficiency of the lattice-based crypto system of the PQC. For example, the NTT and the INTT must have complex control logic to control multiple computations with nested loops, so as to achieve polynomial multiplication computations. The accessing and scheduling for polynomial coefficients in the polynomial multiplication computations are relatively complex, which results in great data transmission and thus consumes more communication bandwidth.

Moreover, in the existing technology, the basic computation structure of polynomial multiplication computation of the NTT and the INTT is a “butterfly computation”. However, the existing architecture of the butterfly computation includes different butterfly computations with a cross-type, hence multiple different butterfly computation circuits must be provided to achieve the entire butterfly computation architecture. In other words, in the existing technology, it is impossible to achieve the entire butterfly computing architecture based on the same butterfly computing circuit with a cross-type, hence, a larger number of different butterfly computing circuits must be provided. Therefore, the hardware cost of the lattice-based crypto system is significantly increased.

In view of the above issues, there is a need for an improved computing device for the lattice-based crypto system, which is able to implement the NTT and INTT based on a simplified butterfly computation architecture, so as to reduce the number of butterfly computation circuits. Moreover, the results of the butterfly computations can be accessed based on an improved memory access mechanism, so as to achieve higher accessing efficiency and data accuracy.

SUMMARY

According to one embodiment of the present disclosure, a computing device is provided. The computing device is used to perform a transforming computation with a first amount of stage computations. The stage computations comprise several odd stage computations and several even stage computations, and the odd stage computations comprise a first stage computation. The computing device comprises a stage computation circuit, a sorting circuit, a first memory and a second memory. The stage computation circuit is repeatedly used to perform each of the stage computations, each of the stage computations comprises a second amount of butterfly computations, and each of the stage computations has a third amount of input data. The stage computation circuit comprises several butterfly computation circuits with the second amount, and the butterfly computation circuits are used to perform the butterfly computations according to several weight coefficients and the input data of each of the stage computations, so as to generate a stage computation result of each of the stage computations. The sorting circuit is repeatedly used to sort the input data of each of the stage computations or the stage computation result to generate a sorting result. The first memory is used to store the input data of the first stage computation and the stage computation result of each of the even stage computations or the sorting result of each of the even stage computations. The second memory is used to store the stage computation result of each of the odd stage computations or the sorting result of each of the odd stage computations.

BRIEF DESCRIPTION OF THE DRAWINGS

FIG. 1 is a block diagram of a computing device 1000 according to an embodiment of the present disclosure.

FIG. 2 is a schematic diagram of a butterfly computation architecture of the NTT according to an embodiment of the present disclosure.

FIG. 3 is a schematic diagram of a butterfly computation architecture of the INTT according to an embodiment of the present disclosure.

FIG. 4A is a schematic diagram of the ping-pong memory mechanism of the NTT according to an embodiment of the present disclosure.

FIG. 4B is a detailed schematic diagram of the ping-pong memory mechanism of the NTT in FIG. 4A.

FIG. 5A is a schematic diagram of the ping-pong memory mechanism of the INTT according to an embodiment of the present disclosure.

FIG. 5B is a detailed schematic diagram of the ping-pong memory mechanism of the INTT of FIG. 5A.

FIG. 6 is a flow diagram of the ping-pong memory mechanism of the NTT and the INTT.

FIG. 7A is a block diagram of a computing device 1001 according to another embodiment of the present disclosure.

FIG. 7B is a block diagram of another example of the computing device 1001 of FIG. 7A.

FIG. 8A is a block diagram of a computing device 1002 according to another embodiment of the present disclosure.

FIG. 8B is a block diagram of another example of the computing device 1002 of FIG. 8A.

FIGS. 9A to 9C are schematic diagrams illustrating the computing device 1000 of the present disclosure is applied to different functional modules of the lattice-based crypto system 2000 for post-quantum cryptography.

In the following detailed description, for purposes of explanation, numerous specific details are set forth in order to provide a thorough understanding of the disclosed embodiments. It will be apparent, however, that one or more embodiments may be practiced without these specific details. In other instances, well-known structures and devices are schematically shown in order to simplify the drawing.

DETAILED DESCRIPTION

The computing device 1000 of the present disclosure is used to perform transforming computation(s). The transforming computation is, for example, a number theoretic transform (NTT) computation or an inverse number theoretic transform (INTT) computation. Please refer to FIG. 1, which is a block diagram of a computing device 1000 according to an embodiment of the present disclosure. The computing device 1000 includes a stage computation circuit 100, a sorting circuit 200, an internal memory 300, a first memory 400, a second memory 500 and a control circuit 600. In this embodiment, the internal memory 300 may be disposed in the stage computation circuit 100.

Hereinafter, the NTT will be taken as an example for describing the present disclosure. The NTT includes stage computations of M stages, for processing input data a[0]~a[N−1] of N points, which is an N-point and M-stage NTT. Both N and M are positive integers, and the relationship between N and M is as shown in equation (1):


M=log2(N)  (1)

The stage computation circuit 100 and the sorting circuit 200 may be repeatedly used to perform all of M stages of the stage computations. For example, the stage computation circuit 100 performs the stage computation of the first stage to generate the stage computation result SR(1) of the first stage. Then, the sorting circuit 200 sorts the stage computation result SR(1) to generate a sorting result PSR(1). Then, the stage computation circuit 100 performs the stage computation of the second stage, according to the sorting result PSR(1), so as to generate the stage computation result SR(2) of the second stage. Then, the sorting circuit 200 sorts the stage computation result SR(2) to generate the sorting result PSR(2). In this manner, the stage computation circuit 100 and the sorting circuit 200 are repeatedly used to perform stage computations and sorting in each stage, until the stage computation result SR(M) and sorting result PSR(M) of the M-th stage (the last stage) are generated. The sorting result PSR(M) of the M-th stage serves as a final result of the NTT.

Each stage in the stage computations includes multiple butterfly computations, and each butterfly computation at least includes one multiplication computation, one addition computation and one subtraction computation. The internal memory 300 is used to perform an in-memory computation (IMC) to perform the multiplication computations of each stage of stage computations. For example, the internal memory 300 may pre-store N/2 weight coefficients

W N 0 ~ W N N 2 - 1 ,

and these weight coefficients

W N 0 ~ W N N 2 - 1

are referred to as “Omega coefficients”. The input data a[0]~a[N−1] with N points are performed with multiplication computation iteratively according to the weight coefficients

W N 0 ~ W N N 2 - 1 .

Furthermore, the input data of each stage computation and the corresponding sorting result are accessed in the first memory 400 and the second memory 500 in an interleaved manner using a ping-pong memory mechanism.

On the other hand, when the computing device 1000 performs the INTT, the sorting circuit 200 first performs the sorting, and then the stage computation circuit 100 performs the stage computation. For example, the sorting circuit 200 sorts the input data a[0]~a[N−1] to generate the sorting result PISR(1), and then the stage computation circuit 100 executes the first stage computation according to the sorting result PISR(1), to generate the stage computation result ISR(1). Then, the stage computation result ISR(1) is provided to the sorting circuit 200 for sorting to generate the sorting result PISR(2). Then, the stage computation circuit 100 performs the second stage computation according to the sorting result PISR(2) to generate the stage computation result ISR(2). In this manner, the sorting circuit 200 and the stage computation circuit 100 are repeatedly used to perform the sorting and stage computation of each stage, until the stage computation result ISR(M) of the M-th stage (i.e., the last stage) is generated as the final result of the NTT.

The input data of the stage computation of the stage computation circuit 100 and the sorting results PSR(1)~PSR(M) generated by the sorting circuit 200 are accessed in an interleaved manner in the first memory 400 and the second memory 500 according to the ping-pong memory mechanism. The control circuit 600 may generate a clock signal or execute a state machine for controlling the sequential operations of the stage computation circuit 100, the sorting circuit 200, the first memory 400 and the second memory 500. The following paragraphs will further describe that, the stage computation circuit 100 and the sorting circuit 200 are repeatedly used to perform the NTT or the INTT, and describe the input data and sorting results of each stage of the stage computations are accessed in the first memory 400 and the second memory 500 in an interleaved manner according to the of the ping-pong memory mechanism.

Please refer to FIG. 2, which is a schematic diagram of a butterfly computation architecture of the NTT according to an embodiment of the present disclosure. In the embodiment of FIGS. 2, N=8 and M=3, and there are 3 stages of stage computations to process 8 points of input data a[0]~a[7]. The stage computation circuit 100 includes four butterfly computation circuits 11, 12, 13 and 14. Each of the butterfly computation circuits 11 to 14 performs a butterfly computation, and each butterfly computation includes a multiplication computation, an addition computation and a subtraction computation. The above-mentioned multiplication, addition and subtraction computations are modular computations. For example, the butterfly computation circuit 11 is used to process input data a[0] and input data a[4]. The butterfly computation circuit 11 firstly performs the multiplication computation of the input data a[4] and the weight coefficient

W 8 0

to obtain the multiplication computation result

( a [ 4 ] * W 8 0 ) .

The above multiplication result

( a [ 4 ] * W 8 0 )

is added to the input data a[0] to obtain the addition computation result b0. The multiplication computation result

( a [ 4 ] * W 8 0 )

is subtracted from the input data a[0] to computation result obtain the subtraction computation result b1. Similarly, the next butterfly computation circuit 12 firstly performs the multiplication computation of the input data a[6] and the weight coefficient

W 8 0

to obtain the multiplication computation result

( a [ 6 ] * W 8 0 ) .

The above multiplication computation result

( a [ 6 ] * W 8 0 )

is added to the input data a[2] to obtain the addition computation result b2. The multiplication computation result

( a [ 6 ] * W 8 0 )

is subtracted from the input data a[2] to obtain the subtraction computation result b3. In this manner, the next butterfly computation circuit 13 firstly performs the multiplication computation of the input data a[5] and the weight coefficient

W 8 0

to obtain the multiplication computation result

( a [ 5 ] * W 8 0 ) ,

and performs an addition computation with the input data a[1] to obtain the addition computation result b4, and performs a subtraction computation with the input data a[1] to obtain the subtraction computation result b5. Another butterfly computation circuit 14 performs the multiplication computation of the input data a[7] and the weight coefficient

W 8 0 ,

and then performs addition and subtraction weight coefficient computations on the multiplication computation result and the input data a[3] to obtain the addition computation result b6 and subtraction computation result b7. The above computations of the butterfly computation circuits 11 to 14 are referred to as the first stage computation s1 of the NTT performed by the stage computation circuit 100. To sum up, the input data of the first stage computation s1 is the 8-point input data a[0]~a[7], and the output data generated by the first stage computation s1 is the 8-point computation results b0~b7, including 4 addition computation results b0, b2, b4 and b6, and 4 subtraction computation results b1, b3, b5 and b7. The stage computation result SR(1) of the first stage computation s1 is the 8-point output data (i.e., the computation results b0~b7). Only 1 clock cycle is required to complete the first stage computation s1.

Then, the sorting circuit 200 sorts the first stage computation result SR(1) to obtain the first stage sorting result PSR(1). In this embodiment, the sorting operation performed by the sorting circuit 200 is: sorting the results b0, b2, b4 and b6 corresponding to the even points as the first 4 points, serving as the first 4 points of the first stage sorting result PSR(1). Furthermore, sort the results b1, b3, b5 and b7 corresponding to the odd points as the last 4 points, serving as the last 4 points of the first stage sorting result PSR(1). Therefore, the first stage sorting result PSR(1) includes b0, b2, b4, b6, b1, b3, b5 and b7 in sequence, which are sequentially used as the eight input data of the second stage computation s2. In other words, the first stage computation s1 is referred to as a “current stage computation”, and the second stage computation s2 is referred to as a “post stage computation”. The sorting circuit 200 sorts the even points b0, b2, b4 and b6 of the stage computation result SR(1) of the current stage computation as the first half portion of the input data of the post stage computation (i.e., the first 4 points of the input data), and sorts the odd points b1, b3, b5 and b7 of the stage computation result SR(1) as the second half portion of the input data of the post stage computation (i.e., the last 4 points of the input data).

The butterfly computation circuits 11 to 14 are repeatedly used to perform the second stage computation s2, including: the butterfly computation circuit 11 performs multiplication computation on the sorted result b2 and the weight coefficient W80, and then performs addition computation and subtraction computation on the multiplication computation result with the sorted result b0 to obtain the addition computation result c0 and the subtraction computation result c1. The butterfly computation circuit 12 performs a multiplication computation on the sorted result b6 and the weight coefficient W80, and then performs addition and subtraction computations on the multiplication result and the sorted result b4 to obtain the addition computation result c2 and the subtraction computation result c3. Similarly, the butterfly computation circuit 13 performs processing on the sorted result b3 and the sorted result b1 to obtain an addition computation result c4 and a subtraction computation result c5. The butterfly computation circuit 14 performs processing on the sorted result b7 and the sorted result b5 to obtain an addition computation result c6 and a subtraction computation result c7. To sum up, the input data of the second stage computation s2 are the 8-point data b0~b7. The output data generated by the second stage computation s2 are 8-point computation results c0~c7, including 4 addition computation results c0, c2, c4, and c6, and 4 subtraction computation results c1, c3, c5, and c7. The stage computation result SR(2) of the second stage computation s2 is the 8-point output data (i.e., the computation results c0~c7). Only 1 clock cycle is required to complete the second stage computation s2.

Then, the sorting circuit 200 is repeatedly used to sort the second stage computation result SR(2) to obtain the second stage sorting result PSR(2). The sorting operation is the same as the sorting operation of the first stage, which is to sort the results c0, c2, c4 and c6 corresponding to the even points as the first 4 points, and sort the results c1, c3, c5 and c7 corresponding to the odd points as the last 4 points. Therefore, the sorting result PSR(2) of the second stage includes c0, c2, c4, c6, c1, c3, c5 and c7 in sequence, which are sequentially used as the eight input data of the third stage computation s3.

Then, the butterfly computation circuits 11 to 14 are reused again to perform the third stage computation s3, including: the butterfly computation circuit 11 performs computations on the sorted results c0 and c2 to obtain computation results do and d1. The butterfly computation circuit 12 performs computations on the sorted results c4 and c6 to obtain computation results d2 and d3. The butterfly computation circuit 13 performs computations on the sorted results c1 and c3 to obtain computation results d4 and d5. The butterfly computation circuit 14 performs computations on the sorted results c5 and c7 to obtain computation results d6 and d7. The third stage computation result SR(3) of the third stage computation s3 includes d1~d7 in sequence. Then, the sorting circuit 200 is repeatedly used to sort the third stage computation result SR(3) to obtain the third stage sorting result PSR(3), which includes: d0, d2, d4, d6, d1, d3, d5 and d7. Finally, the sorting result PSR(3) is outputted as the final result of the NTT. The third stage computation s3 only requires 1 clock cycle to be completed. In other words, each stage computation of the NTT only takes one clock cycle to be completed.

Next, please refer to FIG. 3, which is a schematic diagram of a butterfly computation architecture of the INTT according to an embodiment of the present disclosure. In this embodiment, the four butterfly computation circuits 21~24 of the stage computation circuit 100 and the sorting circuit 200 are also repeatedly used to perform the INTT with 8-point input data a[0]~a[7] and three stage computations. However, unlike the NTT of the embodiment of FIG. 2, the INTT of this embodiment utilizes the sorting circuit 200 to perform sorting firstly, and then utilizes the stage computation circuit 100 to perform the stage computation. The input data a[0]~a[7] are immediately inputted to the sorting circuit 200 for sorting (before sorting, the first stage computation is1 is not performed), and the input data a[0], a[1], a[2] and a[3] corresponding to the first 4 points are sorted as odd points, and the input data a[4], a[5], a[6] and a[7] corresponding to the last 4 points are sorted as even points. Therefore, it obtains the first stage sorting result PISR(1), which are a[0], a[4], a[1], a[5], a[2], a[6], a[3] and a[7]. Moreover, the first stage sorting result PISR(1) is used as the input of the first stage computation is1.

The stage computation circuit 100 executes the first stage computation is1 based on the first stage sorting result PISR(1). The butterfly computation circuit 21 first performs the addition computation of the input data a[0] and the input data a[4] to obtain the computation result e0. Furthermore, the subtraction computation of the input data a[0] and the input data a[4] is performed, and the multiplication computation of the subtraction computation result and the weight coefficient

W 8 0

is performed to obtain the computation result e1. The next butterfly computation circuit 22 firstly performs the addition computation of the input data a[1] and the input data a[5] to obtain the computation result e2. Furthermore, the subtraction computation of the input data a[1] and the input data a[5] is performed, and the multiplication computation of the subtraction computation result and the weight coefficient Wg is performed to obtain the computation result e3. Similarly, the butterfly computation circuit 23 performs addition, subtraction computations and multiplication computations according to the input data a[2] and the input data a[6] to obtain computation results e4 and e5. Another butterfly computation circuit 24 performs addition, subtraction and multiplication computations according to the input data a[3] and the input data a[7] to obtain computation results e6 and e7. In summary, the butterfly computation circuits 21 to 24 of the stage computation circuit 100 execute the first stage computation is1 to obtain the first stage computation result ISR(1). The first stage computation result ISR(1) includes the results e0~e7 in sequence. In the INTT, the overall computations of the first stage include: the sorting operation of the first stage and the stage computation is1 of the first stage. Firstly, the first stage sorting result PISR(1) is generated, then the first stage computation result ISR(1) is generated based on the first stage sorting result PISR(1).

Then, the sorting circuit 200 sorts the first stage computation result ISR(1), to sort the computation results e0~e3 corresponding to the first 4 points as odd points, and sort the computation results e4~e7 corresponding to the last 4 points as even points, so as to obtain the second stage sorting result PISR(2). The second stage sorting result PISR(2) is: e[0], a[4], e[1], e[5], e[2], e[6], e[3] and e[7]. Furthermore, the second stage sorting result PISR(2) is used as the input of the second stage computation is2.

In other words, the first stage computation is1 is referred to as the “current stage computation”, and the second stage computation is2 is referred to as the “post stage computation”. The sorting circuit 200 sorts the first half portion e0~e3 of the stage computation result ISR(1) of the current stage computation (i.e., the first 4 points of the stage computation result ISR(1)) as the even points of the input data of the post stage computation, and the second half portion e4~e7 of the stage computation result ISR(1) of the current stage computation (i.e., the last 4 points of the stage computation result ISR(1)) are sorted as the odd points of the input data of the post stage computation.

Next, the stage computation circuit 100 takes the sorting result PISR(2) as input and performs the second stage computation is2. The butterfly computation circuit 21 performs addition, subtraction and multiplication computations according to the computation results e0 and e4 to obtain the computation results f0 and f1. The butterfly computation circuit 22 performs addition, subtraction and multiplication computations according to the computation results e1 and e5 to obtain the computation results f2 and f3. The butterfly computation circuit 23 performs addition, subtraction and multiplication computations according to the computation results e2 and e6 to obtain the computation results f4 and f5. The butterfly computation circuit 24 performs addition, subtraction and multiplication computations according to the computation results e3 and e7 to obtain the computation results f6 and f7. In summary, the butterfly computation circuits 21 to 24 of the stage computation circuit 100 execute the second stage computation is2 to obtain the second stage computation result ISR(2). The second stage computation result ISR(2) includes f0~f7 in sequence. To sum up, in the INTT, the overall computations of the second stage include: the sorting operation of the second stage and the stage computation is2 of the second stage. The second stage sorting result PISR(2) is firstly generated, and then the second stage computation result ISR(2) is generated based on the second stage sorting result PISR(2).

Similar to the stage computations and sorting operation of the first stage and the second stage, the sorting circuit 200 sorts the stage computation results ISR(2) of the second stage, in which the computation results f0~f3 corresponding to the first 4 points are sorted as odd points, and the computation results f4~f7 corresponding to the last 4 points are sorted as even points, so as to generate the third stage sorting result PISR(3). The sorting result PISR(3) is: f0, f4, f1, f5, f2, f6, f3 and f7. Moreover, in the third stage computation is3, the butterfly computation circuits 21 to 24 of the stage computation circuit 100 correspondingly perform addition, subtraction and multiplication computations according to the sorting result PISR(3), so as to obtain the third stage computation result ISR(3) which includes the computation results g0~g7 in order. The overall computations of the third stage include: the sorting operation of the third stage and the stage computation is3 of the third stage. Firstly, the third stage sorting result PISR(3) is generated, and then the third stage computation result ISR(3) is generated based on the third stage sorting result PISR(3). Furthermore, the third stage computation result ISR(3) is outputted as the final result of the INTT. Each of the stage computations is1~is3 of the INTT only requires one clock cycle to be completed.

In the NTT of FIG. 2, the first stage computation result SR(1) is sorted by the sorting circuit 200 to obtain the sorting result PSR(1), and the sorting result PSR(1) is provided to the stage computation circuit 100 to perform the second stage computation s2. That is, the first stage computation result SR(1) is not directly provided to the stage computation circuit 100 to perform the second stage computation s2. Therefore, the butterfly computation architecture of the second stage computation s2 is the same as that of the first stage computation s1, and the same four butterfly computation circuits 11 to 14 can be reused to execute the second stage computation s2. Similarly, the same four butterfly computation circuits 11 to 14 can also be reused to perform the third stage computation s3. Accordingly, the number of butterfly computing circuits can be saved, and the hardware structure of the computing device 1000 can be greatly simplified.

Similarly, in the INTT of FIG. 3, the first stage computation result ISR(1) is sorted by the sorting circuit 200 to obtain the sorting result PISR(2), and provided to the first stage computation circuit 100 to perform the second stage computation is2. The first stage computation result ISR(1) is not directly provided to the stage computation circuit 100 to perform the second stage computation is2. Therefore, the butterfly computation structure of the second stage computation is2 is the same as the first stage computation is1 (similarly, the butterfly computation structure of the third stage computation is3 is also the same as the first stage computation is1). Therefore, the same four butterfly computation circuits 21 to 24 can be repeatedly used to perform the first to third stage computations is1 to is3 of the INTT.

Next, please refer to FIG. 4A, which is a schematic diagram of the ping-pong memory mechanism of the NTT according to an embodiment of the present disclosure. Stage computations with total M stages may be divided into odd stage computations and even stage computations. The odd stage computations include the first stage, the third stage, the fifth stage, . . . , etc. The even stage computations include the second stage, the fourth stage, the sixth stage, . . . , etc. According to the ping-pong memory mechanism, the input data and sorting results corresponding to the odd stage computations and the even stage computations are accessed in the first memory 400 or the second memory 500 in an interleaved manner. More specifically, the input data a[0]~a[N−1] are firstly written into the first memory 400, and then, according to the interleaving rules of odd stage computations/even stage computations, the input data and sorting results of each stage computation are accessed in the first memory 400 or the second memory 500 in an interleaved manner. The interleaving rules are described as follows: the stage computation circuit 100 reads the input data of the odd stage computation from the first memory 400 (where the input data of the first stage computation is the input data a[0]~a[N−1]). The stage computation circuit 100 performs odd stage computation according to the read input data, so as to generate the stage computation result SR(j) of the odd stage computation (the argument “j” is an odd number indicating an odd stage, where j=1,3,5, . . . , M). Then, the sorting circuit 200 performs sorting on the stage computation result SR(j) of the odd stage computation, so as to generate the sorting results PSR(j) of the odd stage computation. Furthermore, the sorting circuit 200 writes the sorting result PSR(j) of the odd stage computation into the second memory 500.

Next, the stage computation circuit 100 reads the sorting result PSR(j) of the odd stage computation from the second memory 500 as the input data of the even stage computation. The stage computation circuit 100 performs the even stage computation according to the read input data to generate the stage computation result SR(k) of the even stage computation (the argument “k” is an even number indicating an even stage, where k=2,4,6, . . . , (M−1)). Then, the sorting circuit 200 performs sorting on the stage computation results SR(k) of even stage computation, so as to generate the sorted result PSR(k) of even stage computation. Furthermore, the sorting circuit 200 writes the sorting result PSR(k) of the even stage computation into the first memory 400.

Then, the previous cycle is repeated: the stage computation circuit 100 reads the sorting result PSR(k) of the even stage computation from the first memory 400 as the input data of the odd stage computation, and the stage computation circuit 100 performs odd stage computations on the input data to produce the odd stage computation result SR(j). Then, the sorting circuit 200 performs sorting on the stage computation result SR(j) of the odd stage computation, so as to generate the sorting result PSR(j) of the odd stage computation. Furthermore, the sorting circuit 200 writes the sorting result PSR(j) of the odd stage computation into the second memory 500. Then, the stage computation circuit 100 reads the sorting result PSR(j) of the odd stage computation from the second memory 500 as input data to perform the even stage computation, and generates the stage computation result SR(k) of the even stage computation. Then, the sorting circuit 200 performs sorting on the stage computation results SR(k) of the even stage computation to generate a sorting result PSR(k) and writes it into the first memory 400.

According to the above-mentioned interleaving rules, the sorting result PSR(M) obtained by sorting the stage computation result SR(M) of the last stage (i.e., the M-th stage, which is, for example, an odd stage) is written into the second memory 500. The sorting result PSR(M) of the M-th stage computation is read from the second memory 500, and outputted as the final result of the NTT.

Next, please refer to FIG. 4B, which is a detailed schematic diagram of the ping-pong memory mechanism of the NTT in FIG. 4A. Firstly, the internal memory 300 in the stage computation circuit 100 is initialized, so as to set the internal parameters of the stage computation of the NTT. The internal parameters are weight coefficients

W N 0 ~ W N N 2 - 1

of the multiplication computation parameters are weight coefficients of each stage computation. Then, in the executing action marked as thin solid circle frame “1” in FIG. 4B, the input data a[0]~a[N−1] are written into the first memory 400. Then, the input data a[0]~a[N−1] are read from the first memory 400. Then, in the executing action marked as thin solid circle frame “2” in FIG. 4B, the first stage computation s1 is executed according to the read input data a[0]~a[N−1], so as to generate the first stage computation result SR(1). In the butterfly computation of stage computation s1, the corresponding multiplication computation is performed on the weight coefficient

W N 0 ~ W N N 2 - 1

and the input data a[0]~a[N−1], and the multiplication computation is achieved by the internal memory 300 in the stage computation circuit 100 using the in-memory computation mechanism. Then, in the executing action marked as thin solid circle frame “3” in FIG. 4B, the sorting circuit 200 performs sorting on the first stage computation result SR(1), so as to generate the first stage sorting result PSR(1). Then, in the executing action marked as thin solid circle frame “4” in FIG. 4B, the first stage sorting result PSR(1) is written into the second memory 500.

Next, the first stage sorting result PSR(1) is read from the second memory 500. Then, in the executing action marked as thick solid circle frame “2” in FIG. 4B, the second stage computation s2 is executed to generate the second stage computation result SR(2). Then, in the executing action marked as thick solid circle frame “3” in FIG. 4B, the sorting circuit 200 performs sorting on the second stage computation result SR(2), so as to generate the second stage sorting result PSR(2). Then, in the executing action marked as thick solid circle frame “4” in FIG. 4B, the second stage sorting result PSR(2) is written into the first memory 400.

Next, the second stage sorting result PSR(2) is read from the first memory 400. Then, in the executing action marked as thin dotted circle frame “2” in FIG. 4B, the third stage computation s3 is executed to generate the third stage computation result SR(3). Then, in the executing action marked as thin dotted circle frame “3” in FIG. 4B, the sorting circuit 200 performs sorting on the third stage computation result SR(3) to generate the third stage sorting result PSR(3). Then, in the executing action marked as thin dotted circle frame “4” in FIG. 4B, the third stage sorting result PSR(3) is written into the second memory 500.

In this manner, the above executing actions are repeated to achieve subsequent stage computations and sorting operations of the fourth stage to the M-th stage. The sorting result PSR(M) of the M-th stage (i.e., the last stage) is written into the first memory 400 or the second memory 500 (depending on whether M is an odd number or an even number). Furthermore, the M-th stage sorting result PSR(M) is read from the first memory 400 or the second memory 500, and outputted as the final result of the NTT.

The above paragraphs with reference to FIGS. 4A and 4B describe accessing operation of the first memory 400 and the second memory 500 when executing the NTT, and the following paragraphs with reference to FIGS. 5A and 5B will describe accessing operation of the first memory 400 and the second memory 500 when executing the INTT. When performing the INTT, the input data is firstly sorted to produce a sorting result, and then a stage computation is performed on the sorting result to generate a stage computation result.

Next, please refer to FIG. 5A, which is a schematic diagram of the ping-pong memory mechanism of the INTT according to an embodiment of the present disclosure. The input data a[0]~a[N−1] are firstly written into the first memory 400. The sorting circuit 200 reads the input data a[0]~a[N−1] or the stage computation result ISR(k) of the even stage computation of the INTT from the first memory 400 to perform sorting, and generates the sorting result of PISR(k+1) of the even stage computation (where the argument k is an even number, k=2,4,6, . . . , etc.). Then, the stage computation circuit 100 performs stage computation according to PISR(k+1) to generate the stage computation result ISR(j) of the odd stage computation (wherein the argument j is an odd number, j=1, 3, 5, . . . , etc.). Furthermore, the stage computation circuit 100 writes the stage computation result ISR(j) of the odd stage computation into the second memory 500.

Next, the sorting circuit 200 reads the stage computation result ISR(j) of the odd stage computation from the second memory 500 and performs sorting, so as to generate the sorting result PISR(j+1) of the odd stage computation and provides it to the stage computation circuit 100, serving as input data for even stage computations. The stage computation circuit 100 performs even stage computation according to the sorting result PISR(j+1) of the odd stage computation, so as to generate a stage computation result ISR(k). Furthermore, the stage computation circuit 100 writes the stage computation result ISR(k) of the even stage computation into the first memory 400.

Then, the previous cycle is repeated, until the stage computation result ISR(M) of the last stage (i.e., the M-th stage, which is, for example, an odd stage) is generated and written into the second memory 500. The stage computation result ISR(M) of the M-th stage is read from the second memory 500 and outputted as the final result.

Next, please refer to FIG. 5B, which is a detailed schematic diagram of the ping-pong memory mechanism of the INTT of FIG. 5A. Firstly, the internal memory 300 in the stage computation circuit 100 is initialized, so as to set the internal parameters of the stage computation of the INTT (i.e., the weight coefficients

W N 0 ~ W N N 2 - 1

of the multiplication computation). Then, in the executing action marked as “1” in the thick solid circle frame in FIG. 5B, the input data a[0]~a[N−1] are written into the first memory 400. Then, the input data a[0]~a[N−1] are read from the first memory 400. Then, in the executing action marked as “2” in the thick solid circle frame in FIG. 5B, the sorting circuit 200 sorts the read input data a[0]~a[N−1] to generate the first stage sorting result PISR(1). Then, in the executing action marked as “3” in the thick solid circle frame in FIG. 5B, the first stage computation is1 of the INTT is executed according to the first stage sorting result PISR(1) to generate the first stage computation result ISR(1). The multiplication computation of the stage computation is1 is achieved by the internal memory 300 in the stage computation circuit 100 where the in-memory computation is performed. Then, in the executing action marked as “4” in the thick solid circle frame in FIG. 5B, the first stage computation result ISR(1) is written into the second memory 500.

Next, the first stage computation result ISR(1) is read from the second memory 500. Then, in the executing action marked as “2” in the thin solid circle frame in FIG. 5B, the sorting circuit 200 performs sorting on the first stage computation result ISR(1), so as to generate the second stage sorting result PISR(2). Then, in the executing action marked as “3” in the thin solid circle frame in FIG. 5B, the second stage computation is2 of the INTT is performed according to the second stage sorting result PISR(2) to generate the second stage computation result ISR(2). Then, in the executing action marked as “4” in the thin solid circle frame in FIG. 5B, the stage computation result ISR(2) is written into the first memory 400.

Next, the second stage computation result ISR(2) is read from the first memory 400. Then, in the executing action marked as “2” in the thin dotted circle frame in FIG. 5B, the sorting circuit 200 performs sorting on the second stage computation result ISR(2), so as to generate the third stage sorting result PISR(3). Then, in the executing action marked as “3” in the thin dotted circle frame in FIG. 5B, the third stage computation is3 of the INTT is performed according to the third stage sorting result PISR(3), so as to generate the third stage computation result is ISR(3). Then, in the executing action marked as “4” in the thin dotted circle frame in FIG. 5B, the third stage computation result ISR(3) is written into the second memory 500.

In this manner, the above executing actions are repeated, so as to achieve sorting operations and stage computations in the subsequent 4-th stage to M-th stage. The stage computation result ISR(M) of the M-th stage (i.e., the last stage) is written into the first memory 400 or the second memory 500 (depending on whether M is an odd number or an even number). Furthermore, the stage computation result ISR(M) of the M-th stage is read from the first memory 400 or the second memory 500, and outputted as the final result.

Next, please refer to FIG. 6, which is a flow diagram of the ping-pong memory mechanism of the NTT and the INTT. Firstly, step S600 is executed: initializing the related data of the internal memory 300 in the stage computation circuit 100 for in-memory computation, including: the input data a[0]~a[N−1] and the weight coefficients

W N 0 ~ W N N 2 - 1

stored in the internal memory 300 are set for initialization.

Then, step S602 is executed: accessing the first memory 400 or the second memory 500. The input data a[0]~a[N−1] are firstly written into the first memory 400, and the stage computation circuit 100 reads the input data a[0]~a[N−1] from the first memory 400.

Then, step S604 is executed: performing a NTT according to the input data a[0]~a[N−1]. Step S604 includes a sub-step S6041 and a sub-step S6042. In the sub-step S6041, the stage computation circuit 100 performs the first stage computation of the NTT on the input data a[0]~a[N−1] to generate the stage computation result SR(1). Then, in the sub-step S6042, the sorting circuit 200 sorts the first stage computation result SR(1) to generate the sorting result PSR(1). Then, step S608 is executed: writing the first stage sorting result PSR(1) into the first memory 400 or the second memory 500. The current execution is: writing the sorting result PSR(1) into the second memory 500.

Then, step S602 is executed again: accessing the first memory 400 or the second memory 500. The current execution is: reading the first stage sorting result PSR(1) from the second memory 500. Then, step S6041 is performed again: the stage computation circuit 100 performs the second stage computation on the first stage sorting result PSR(1) to generate the stage computation result SR(2). Then, the step S6042 is executed again: the sorting circuit 200 sorts the second stage computation results SR(2) to generate the sorting result PSR(2). Then, step S608 is executed: writing the second stage sorting result PSR(2) into the first memory 400 or the second memory 500. The current execution is: writing the sorting result PSR(2) into the first memory 400.

Then, steps S602, S604 and S608 are executed again to perform the stage computation and sorting operation of the third stage, so as to generate the third stage computation result SR(3) and the third stage sorting result PSR(3). The sorting result PSR(3) is written into the second memory 500. In this manner, steps S602, S604 and S608 are repeatedly executed, so as to perform stage computations and sorting operation in the subsequent 4-th stage to the M-th stage (i.e., the last stage). Finally, in the step S608 of the M-th stage, the sorting result PSR(M) of the M-th stage is outputted as the final result.

On the other hand, if the INTT is performed, step S606 is executed (after step S602): the INTT is performed according to the input data a[0]~a[N−1], including sub-steps S6061 and sub-step S6062. In sub-step S6061, the sorting circuit 200 performs sorting on the input data a[0]~a[N−1] to generate the first stage sorting result PISR(1). Then, in sub-step S6062, the stage computation circuit 100 performs the first stage computation of the INTT on the sorting result PISR(1) to generate the stage computation result ISR(1). Then, step S608 is executed: writing the stage computation result ISR(1) of the first stage into the first memory 400 or the second memory 500. The current execution is: writing the first stage computation result ISR(1) into the second memory 500. Then, step S602 is executed again: reading the first stage computation result ISR(1) of the INTT from the second memory 500. Then, step S6061 is executed: the sorting circuit 200 sorts the stage computation results ISR(1) to generate the second stage sorting result PISR(2). Then, step S6062 is performed: performing the second stage computation of the INTT on the sorting result PISR(2) to generate the stage computation result ISR(2). Then, step S608 is executed: writing the stage computation result ISR(2) into the first memory 400. In this manner, steps S602, S606 and S608 are repeatedly executed to perform sorting operations and stage computations in the subsequent third stage to M-th stage (i.e., the last stage). Finally, in step S608 of the M-th stage, the stage computation result ISR(M) of the M-th stage is outputted as the final result.

Next, please refer to FIG. 7A, which is a block diagram of a computing device 1001 according to another embodiment of the present disclosure. The circuit architecture of the computing device 1001 of this embodiment is substantially the same as the circuit architecture of the computing device 1000 in FIG. 1, and FIG. 7A further illustrates the internal circuit of the stage computation circuit 100 of the computing device 1001, including: an internal memory 300, an modular processing circuit 102 and an addition/subtraction circuit 103.

The computing device 1001 is used to perform a NTT with the input data of 256 points (N=256). The modular processing circuit 102 includes 128 sub-units, and the addition/subtraction circuit 103 also includes 128 sub-units. The amount of sub-units is equal to half of the amount of points of the input data (i.e., N/2). One of the sub-units of the modular processing circuit 102 is a modular processing unit 102(0). One sub-unit of the addition/subtraction circuit 103 is an addition/subtraction unit 103(0), which further includes an addition unit 103a(0) and a subtraction unit 103b(0). The addition unit 103a(0) is used to perform modular addition, and the subtraction unit 103b(0) is used to perform modular subtraction.

The input data of 256 points is read from the first memory 400. Such input data of 256 points are divided into even points and odd points. The even points include input data In_X[0]~In_X[127] of 128 points, and the odd points include input data In_Y[0]~In_Y[127] of 128 points. Moreover, the internal memory 300 stores 128 weight coefficients W[0]~W[127] in advance. Each stage computation of the NTT includes 128 butterfly computations, and each butterfly computation includes one multiplication computation, one addition computation and one subtraction computation. The above-mentioned multiplication, addition and subtraction computations are all modular computations. The multiplication computation is performed in the internal memory 300 using the in-memory computation mechanism.

The input data In_Y[0]~In_Y[127] of the odd points are inputted to the internal memory 300, and the internal memory 300 performs multiplication computations on the input data In_Y[0]~In_Y[127] and the weight coefficients W[0]~W[127] using in-memory computation. Furthermore, the modular processing unit 102(0) performs modular processing with “Barrett Reduction” algorithm on the multiplication result, so as to generate a 128-point computation result In_Y_m[127:0] (which includes In_Y_m[0]~In_Y_m[127]).

The addition/subtraction circuit 103 performs modular addition and modular subtraction on the computation result In_Y_m[127:0] and the input data In_X[0]~In_X[127]. For example, the addition unit 103a(0) of the addition/subtraction circuit 103 performs modular addition computation on the input data In_X[0] and the computation result In_Y_m[0], and the subtraction unit 103b(0) performs modular subtraction computation on the input data In_X[0] and the computation result In_Y_m[0]. In this manner, another addition unit and another subtraction unit respectively perform the modular addition computation and modular subtraction computation on the input data In_X[127] and the computation result In_Y_m[127]. Accordingly, the addition/subtraction circuit 103 generates 256-point computation results NTT_OUT[i] (the argument “I” includes odd numbers and even numbers, where I=0,1,2,3, . . . , 255). The computation result NTT_OUT[i] is sent to the sorting circuit 200 for sorting, and the sorting result is written into the second memory 500. The stage computation circuit 100 is repeatedly used to perform the above-mentioned stage computations, including the stage computations from the first stage to the seventh stage, and the total execution time is 8 clock cycles.

Next, please refer to FIG. 7B, which is a block diagram of another example of the computing device 1001 of FIG. 7A. FIG. 7B does not show the internal memory 300 and control circuit 600 of FIG. 7A. The 256-point input data WL[0]~WL[255] in FIG. 7B includes the 128-point input data In_X[0]~In_X[127] and the 128-point input data In_Y[0]~In_Y[127] in FIG. 7A. More specifically, among the 256-point input data WL[0]~WL[255] in FIG. 7B, the input data WL[0], WL[2], . . . , WL[252], WL[254] of even points represent the input data In_X[0], In_X[1], . . . , In_X[126], In_X[127] of even points. Furthermore, the input data WL[1], WL[3], . . . , WL[253], WL[255] of odd points represent the input data In_Y[0], In_Y[1], . . . , In_Y[126], In_Y[127] of odd points.

In operation, the input data WL[0]~WL[255] are firstly stored in the first memory 400, and are read by the stage computation circuit 100 to perform the stage computation. The stage computation circuit 100 includes 128 butterfly computation circuits BF(0)~BF(127). For example, the butterfly computation circuit BF(0) performs a butterfly computation (including multiplication, addition and subtraction computations) based on the input data WL[0] at the first point, the input data WL[1] at the second point and the weight coefficient W[0]. Furthermore, a modular processing of “Barrett Reduction” algorithm is performed on the result of butterfly computation through the modular processing unit 102(0), so as to generate the computation results NTT_OUT[0] and NTT_OUT[1]. The addition computation result of the butterfly computation circuit BF(0) is performed with modular processing to obtain the computation result NTT_OUT[0], and the subtraction computation result of the butterfly computation circuit BF(0) is performed with modular processing to obtain the computation result NTT_OUT[1].

Similarly, the next butterfly computation circuit BF(1) performs butterfly computation based on the input data WL[2] at the second point, the input data WL[3] at the third point and the weight coefficient W[1], and modular processing is performed by the modular processing unit 102(1), so to generate computation results NTT_OUT[2] and NTT_OUT[3]. In this manner, the butterfly computation circuits BF(0)~BF(127) perform their respective butterfly computations based on the corresponding input data WL[0]~WL[255] and weight coefficients W[0]~W[127], and modular processing is performed by corresponding modular processing units 102(0)~102(127), so as to obtain computation results NTT_OUT[0]~NTT_OUT[255].

Then, the sorting circuit 200 sorts the computation results NTT_OUT[0]~NTT_OUT[255] to generate sorting results NTT_IN [0] ~NTT_IN [255]. The computation result NTT_OUT[k] (where the argument k is an even number) is sorted as the sorting results NTT_IN [0]~NTT_IN [127] of the first 127 points, and the computation result NTT_OUT[j] (where the argument j is an odd number) is sorted as the sorting results NTT_IN [128] ~NTT_IN [255] of the last 127 points. Then, the sorting results NTT_IN [0]~NTT_IN [255] are stored in the second memory 500.

Next, please refer to FIG. 8A, which is a block diagram of a computing device 1002 according to another embodiment of the present disclosure. The circuit structure of the computing device 1002 of this embodiment is similar to the circuit structure of the computing device 1001 of FIG. 7A, but the computing device 1002 of this embodiment is used to perform an INTT of input data of 256 points. The internal circuit of the stage computation circuit 100′ of the computing device 1002 includes: an internal memory 300, a modular processing circuit 102 and an addition/subtraction circuit 103, and the stage computation circuit 100′ cooperates with two division modules 104a and 104b.

The sorting circuit 200 sorts the input data of 256 points, and divides them into even points and odd points. The sorted even points include the input data In_X[0]~In_X[127], and the sorted odd points include the input data In_Y[0]~In_Y[127]. The input data In_X[0]~In_X[127] and the input data In_Y[0]~In_Y[127] are correspondingly performed with modular addition computation, and the result of the modular addition computation is processed by the division module 104a to generate the computation result INTT_OUT[k]. On the other hand, the input data In_X[0]~In_X[127] and the input data In_Y[0]~In_Y[127] are correspondingly performed with modular subtraction computation, so as to generate computation result MOD_SUB_OUT[127:0] of 128 points (which includes MOD_SUB_OUT[0]~MOD_SUB_OUT[127]).

The computation results MOD_SUB_OUT[0]~MOD_SUB_OUT[127] are respectively multiplied with the weight coefficients W[0]~W[127] stored in the internal memory 300 using the in-memory computation mechanism, and processed by the modular processing circuit 102 to obtain the result of the modular multiplication computation. Then, processing is performed by the division module 104b to generate the computation result INTT_OUT[j]. The computation result INTT_OUT[j] and the computation result INTT_OUT[k] generated by the aforementioned division module 104a are integrated as the stage computation result of the current stage, and are sent to the sorting circuit 200 for sorting. In this manner, all butterfly computation circuits BF(0)~BF(127) perform butterfly computations on the input data In_X[0]~In_X[127] of all even points, the input data In_Y[0]~In_Y[127] of all odd points and weight coefficients W[0]~W[127], and the corresponding modular processing units 102(0)~102(127) perform modular processing, so as to obtain the stage computation results of the INTT. The stage computation results are stored in the second memory 500.

Next, please refer to FIG. 8B, which is a block diagram of another example of the computing device 1002 of FIG. 8A. FIG. 8B does not show the internal memory 300 and control circuit 600 of FIG. 8A. Same as the representation of the input data WL[0]~WL[255] in the embodiment of FIG. 7B, the input data WL[0]~WL[255] of 256 points of the computing device 1002 of this embodiment include the even-point input data In_X[0]~In_X[127] of 128 points and the odd-point input data In_Y[0]~In_Y[127] of 128 points.

In operation, the input data WL[0]~WL[255] are firstly stored in the first memory 400. Then, the input data WL[0]~WL[255] are read by the sorting circuit 200 to perform sorting. The sorted input data is sent to the stage computation circuit 100′ for stage computation. The stage computation circuit 100′ includes 128 butterfly computation circuits BF(0)~BF(127) and 128 modular processing units 102(0)~102(127). The butterfly computation circuit BF(0) performs butterfly computation on the sorted input data WL[0], input data WL[128] and weight coefficient W[0], and are performed with modular processing by the modular processing unit 102(0). Similarly, the butterfly computation circuit BF(1) performs butterfly computation on the sorted input data WL[1], input data WL[129] and weight coefficient W[1], and are performed with modular processing by the modular processing unit 102(1). Then, the stage computation result generated by the stage computation circuit 100′ is stored in the second memory 500.

Next, please refer to FIGS. 9A to 9C, which are schematic diagrams illustrating the computing device 1000 of the present disclosure is applied to different functional modules of the lattice-based crypto system 2000 for post-quantum cryptography. The lattice-based crypto system 2000 of FIGS. 9A to 9C is, for example, a “CRYSTALS-Kyber” system. The lattice-based crypto system 2000 includes three functional modules: a “CPAPK.KeyGen” module 2001, a “CPAPK.Enc” module 2002 and a “CPAPK.Dec” module 2003. The above three functional modules all use the computing device 1000 to perform NTT or INTT with 256 points of input data (i.e., N=256). The data width of each input data is 12 bits.

Please refer to FIG. 9A, which illustrates that the computing device 1000 is applied to the “CPAPK.KeyGen” module 2001 of the lattice-based crypto system 2000. The computing device 1000 performs NTT with a number of k for the matrix e and the matrix s, and the NTT has 256 points and the data width of each input data is 12 bits. The computing circuit 800 of the “CPAPK.KeyGen” module 2001 receives the random seed η, and generates matrix Â, matrix e and matrix s which are random. Furthermore, the computing device 1000 performs NTT to transform the matrix e and the matrix s into the matrix ê and the matrix ŝ. Then, the PWM computation circuit 810 obtains the computation result Âŝ according to the matrix  and the matrix ŝ, and adds it to the matrix ê to obtain the summation result Âŝ+ê. Then, the encoding circuit 820 performs encoding based on the summation result Âŝ+ê and the random seed η to generate a public key pk and a private key sk.

Next, refer to FIG. 9B, which illustrates that the computing device 1000 is applied to the “CPAPK.Enc” module 2002 of the lattice-based crypto system 2000. The computing circuit 802 receives the random seed η, a message m and the public key pk, and thereby generates the matrix Â, matrix r, matrix e1 and matrix e2 which are random. Then, the computing device 1000 performs NTT with a number of k for the matrix r to obtain a matrix {circumflex over (r)}, where the NTT has 256 points and the data width of each input data is 12 bits. Furthermore, the PWM computation circuit 812 calculates the matrix AT{circumflex over (r)} and the matrix tT{circumflex over (r)}. Then, the computing device 1000 performs INTT with a number of k for the matrix ÂT{circumflex over (r)}, where the INTT has 256 points and the data width of each input data is 12 bits. Furthermore, the computing device 1000 performs one INTT for the matrix tT{circumflex over (r)} (where the INTT has 256 points and 12 bits). Thereby, matrix ATr and matrix tTr are obtained. Then, the error matrix e1 and error matrix e2 are obtained according to the computing circuit 802, and a summation result ATr+e1 and a summation result tTr+e2+m are generated. Furthermore, the encrypted message c is generated through the compressing and encoding circuit 822.

Next, refer to FIG. 9C, which illustrates that the computing device 1000 is applied to the “CPAPK.Dec” module 2003 of the lattice-based crypto system 2000. The decoding circuit 830 receives the encrypted message c and the private key sk, and then decodes and restores a vector u, a vector v and the matrix ŝ through the decompressing circuit 840. Then, the computing device 1000 performs NTT with a number of k for the matrix u, so as to generate a matrix û, where the NTT has 256 points and the data width of each input data is 12 bits. Furthermore, the PWM computation circuit 814 generates a computation result ŝTû based on the matrix ŝ and the matrix û, and then the computing device 1000 performs INTT with a number of k (where the INTT has 256 points and the data width of each input data is 12 bits) for the computation result ŝTû to produce the matrix sTu. Then, a subtraction computation is performed to obtain the computation result v−sTu. The decrypted message m is then generated through the compressing and encoding circuit 824.

It will be apparent to those skilled in the art that various modifications and variations can be made to the disclosed embodiments. It is intended that the specification and examples be considered as exemplars only, with a true scope of the disclosure being indicated by the following claims and their equivalents.

Claims

1. A computing device, for performing a transforming computation, the transforming computation comprises a first amount of stage computations, the stage computations comprise a plurality of odd stage computations and a plurality of even stage computations, the odd stage computations comprise a first stage computation, and the computing device comprising:

a stage computation circuit, repeatedly used to perform each of the stage computations, each of the stage computations comprises a second amount of butterfly computations, and each of the stage computations has a third amount of input data, and the stage computation circuit comprising:
a plurality of butterfly computation circuits with the second amount, used to perform the butterfly computations according to a plurality of weight coefficients and the input data of each of the stage computations, so as to generate a stage computation result of each of the stage computations;
a sorting circuit, repeatedly used to sort the input data of each of the stage computations or the stage computation result to generate a sorting result;
a first memory, used to store the input data of the first stage computation and the stage computation result of each of the even stage computations or the sorting result of each of the even stage computations; and
a second memory, used to store the stage computation result of each of the odd stage computations or the sorting result of each of the odd stage computations.

2. The computing device of claim 1, wherein the first amount for the stage computations is equal to M, the third amount for the input data of each of the stage computations is equal to N, and the second amount for the butterfly computations is equal to N/2, wherein M and N are both positive integers, and M and N have a first relationship: M=log2(N).

3. The computing device of claim 1, wherein the stage computation circuit further comprising:

an internal memory, used to store the weight coefficients and perform a multiplication computation of each of the butterfly computations according to an in-memory computation mechanism,
wherein, the multiplication computation is used to generate a product of one of the weight coefficients and a corresponding one of the input data of each of the stage computations.

4. The computing device of claim 3, wherein the internal memory is initialized to set the weight coefficients.

5. The computing device of claim 3, wherein each of the butterfly computations further comprises an addition computation and a subtraction computation, and the multiplication computation, the addition computation and the subtraction computation are executed based on a modular process.

6. The computing device of claim 5, wherein the stage computation circuit further comprising:

a modular processing circuit, used to perform the modular process,
wherein, the modular process is performed based on a Barrett Reduction algorithm.

7. The computing device of claim 1, wherein the transforming computation is a number theoretic transform (NTT) or an inverse number theoretic transform (INTT).

8. The computing device of claim 7, wherein when the transforming computation is the NTT, the sorting circuit sorts the stage computation result of each of the stage computations to generate the sorting result.

9. The computing device of claim 8, wherein the stage computations comprise a current stage computation and a post stage computation, the sorting circuit generates the sorting result of the current stage computation, and the sorting result is provided to the stage computation circuit to serve as the input data for the post stage computation.

10. The computing device of claim 9, wherein the sorting circuit performs sorting on the stage computation result, so as to sort a plurality of even points of the stage computation result as a first half portion of the sorting result, and sort a plurality of odd points of the stage computation result as a second half portion of the sorting result.

11. The computing device of claim 7, wherein when the transforming computation is the INTT, the sorting circuit sorts the input data of each of the stage computations to generate the sorting result.

12. The computing device of claim 11, wherein the sorting circuit sends the sorting result to the stage computation circuit, and the stage computation circuit executes the stage computation based on the sorting result to generate the stage computation result.

13. The computing device of claim 12, wherein the sorting circuit performs sorting on the input data, so as to sort a first half portion of the input data as a plurality of even points of the sorting result, and sort a second half portion of the input data as a plurality of odd points of the sorting result.

14. The computing device of claim 7, wherein when the transforming computation is the NTT, the stage computation circuit reads the input data of the first stage computation from the first memory.

15. The computing device of claim 7, wherein when the transforming computation is the NTT, the sorting circuit stores the sorting result of the odd stage computation into the second memory.

16. The computing device of claim 15, wherein the stage computation circuit reads the sorting result of the odd stage computation from the second memory to serve as the input data of the subsequent even stage computation, and correspondingly generates the stage computation result of the even stage computation.

17. The computing device of claim 16, wherein the sorting circuit sorts the stage computation result of the even stage computation to generate the sorting result of the even stage computation, and stores the sorting result of the even stage computation into to the first memory.

18. The computing device of claim 7, wherein when the transforming computation is the INTT, the sorting circuit reads the input data of the first stage computation from the first memory.

19. The computing device of claim 7, wherein when the transforming computation is the INTT, the stage computation circuit stores the stage computation result of the odd stage computation into the second memory.

20. The computing device of claim 19, wherein the sorting circuit reads the stage computation result of the odd stage computation from the second memory and performs sorting on the stage computation result, so as to generate the sorting result of the subsequent even stage computation.

21. The computing device of claim 20, wherein the stage computation circuit utilizes the sorting result of the even stage computation as the input data, so as to correspondingly generate to the stage computation result of the even stage computation, and stores the stage computation result of the even stage computation into the first memory.

22. The computing device of claim 7, wherein the NTT or the INTT is applied to a lattice-based crypto system to perform a vector transformation of a matrix.

Patent History
Publication number: 20260377490
Type: Application
Filed: Aug 29, 2024
Publication Date: Nov 26, 2026
Applicant: INDUSTRIAL TECHNOLOGY RESEARCH INSTITUTE (Chutung, Hsinchu)
Inventors: Chih-Cheng LU (Hsinchu City), Chung-Han LEE (Zhubei City), Cheng-Ming SHIH (Zhubei City)
Application Number: 18/819,499
Classifications
International Classification: G06F 17/14 (20060101);