Multi-scalar multiplication method and device, equipment and storage medium
By splitting and performing multi-scalar multiplication tasks in parallel on the CPU platform, and optimizing point addition operations using bucket point aggregation and tree structure, the problem of popularization and efficiency of multi-scalar multiplication on FPGA or GPU platforms is solved, achieving high efficiency multiscalar multiplication operation.
Patent Information
- Application Number
- CN202411018253.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-07-29
- Publication Date
- 2024-11-29
- Estimated Expiration
- 2044-07-29
AI Technical Summary
In the prior art, multiscalar multiplication operations are usually performed on high-cost FPGA or GPU platforms, and cannot be popularized to all users. When point addition operations are performed under projection coordinates, the modulus multiplication operations are more often, which affects efficiency.
On the CPU platform, by dividing the large-scale elliptic curve multi-scalar multiplication task into multiple subtasks, and using the SIMD instruction set to perform point addition operations in parallel, using bucket point aggregation and tree structure to optimize point addition operations to reduce the number of modulo multiplication operations .
It improves the operation efficiency and universality of multiscalar multiplication, reduces the number of modulus multiplications for point addition operations, thereby speeding up the calculation process and is suitable for CPU platforms.
Smart Images

Figure CN119045894A_ABST
Abstract
Description
Technical Field
[0001] The present disclosure relates to the field of cryptographic technology, and in particular to a multi-scalar multiplication method, device, equipment and storage medium. Background Art
[0002] Multi-scalar multiplication is an important part of zero-knowledge proof. In related technologies, multi-scalar multiplication is usually performed on FPGA (Field-Programmable Gate Array) or GPU (Graphics Processing Unit) platforms. However, the cost of hardware such as FPGA or GPU is high and cannot be popularized to all users. Summary of the invention
[0003] The present disclosure provides a multi-scalar multiplication operation method, apparatus, device and storage medium, which can implement multi-scalar multiplication on a CPU (Central Processing Unit) platform. The technical solution includes at least the following solutions:
[0004] In a first aspect, a multi-scalar multiplication operation method is provided for accelerating the operation process of the multi-scalar multiplication on a central processing unit (CPU) platform, comprising: dividing the original operation task of the large-scale elliptic curve multi-scalar multiplication into a plurality of sub-operation tasks, each of the sub-operation tasks comprising a plurality of point multiplication operations, each of the point multiplication operations comprising a sub-scalar and an elliptic curve point, and the elliptic curve point in each of the point multiplication operations corresponds to the sub-scalar; based on the sub-scalars corresponding to the plurality of elliptic curve points, the plurality of elliptic curve points are filled into a plurality of bucket points, wherein when there are two elliptic curve points that need to be filled into In the case of the first bucket point, the two elliptic curve points are added to the primary storage sequence as a point to be added, and the first bucket point is any one of the multiple bucket points; when there are N points to be added in the primary storage sequence, the N points to be added are executed in parallel based on SIMD instructions to obtain N first point addition results; the N first point addition results are written back to the corresponding bucket points; after the elliptic curve points in the multiple point multiplication operations of any of the sub-operation tasks are filled in the bucket points, bucket point aggregation is performed; based on the results of the bucket point aggregation of each of the sub-operation tasks, the operation result of the original operation task is obtained.
[0005] Optionally, writing the N first point addition results back to the corresponding bucket points includes: for the second point addition result, adding the point addition operation of the second point addition result and the second bucket point as a pending point addition operation to the secondary storage sequence, the second point addition result is any one of the N first point addition results, and the second bucket point is the bucket point corresponding to the second point addition result; when there are at least N pending point addition operations in the secondary storage sequence, executing the first N pending point addition operations in the secondary storage sequence in parallel based on SIMD instructions to obtain N third point addition results; based on the N third point addition results, updating the value of the corresponding bucket point to achieve writing the N first point addition results back to the corresponding bucket points.
[0006] Optionally, in the secondary storage sequence, the first N pending point addition operations in the secondary storage sequence are executed in parallel once, indicating that one round of operations of the secondary storage sequence is completed, and if there are at least two bucket points in the pending point addition operations in the secondary storage sequence of the I round of operations that are the third bucket points, any one of the multiple bucket points of the third bucket point, then the N first point addition results are written back to the corresponding bucket points, including: when there are K bucket points in the pending point addition operations in the secondary storage sequence of the I round of operations that are the third bucket points, K is greater than or equal to 2 and K is an even number, among the first point addition results of the K pending point addition operations, every two first point addition results are used as a pending point addition operation to construct 0.5K pending point addition operations in the secondary storage sequence of the I round of operations; after the I round of operations is completed, the operation results of the 0.5K pending point addition operations are respectively added to the secondary storage sequence with the third bucket point as a pending point addition operation, waiting for the I+1 round of operations; wherein I is a positive integer.
[0007] Optionally, writing the N first point addition results back to the corresponding bucket points also includes: when there are K bucket points to be added in the secondary storage sequence of the I round of operations, which are the third bucket points, and K is greater than or equal to 2 and K is an odd number, taking every two first point addition results in the first K-1 points to be added as a point to be added, so as to construct 0.5 (K-1) points to be added in the secondary storage sequence of the I round of operations; after the I round of operations is completed, adding the results of the 0.5 (K-1) points to be added to the secondary storage sequence as a point to be added, respectively, together with the third bucket point, to wait for the I+1 round of operations.
[0008] Optionally, after all elliptic curve points in the multiple point multiplication operations of any of the sub-operation tasks are filled into the bucket points, bucket point aggregation is performed, including: using the following formula to implement bucket point aggregation for the j-th sub-operation task:
[0009]
[0010] Among them, G j is the jth sub-computation task, B l Represents the lth bucket point, where l is an integer.
[0011] In a second aspect, a multi-scalar multiplication operation device is also provided, which is used to accelerate the operation process of the multi-scalar multiplication on a central processing unit CPU platform, including: a splitting module, which is used to split the original operation task of large-scale elliptic curve multi-scalar multiplication into multiple sub-operation tasks, each of the sub-operation tasks includes multiple point multiplication operations, each of the point multiplication operations includes a sub-scalar and an elliptic curve point, and the elliptic curve point in each point multiplication operation corresponds to the sub-scalar; a first bucket filling module, which is used to fill the multiple elliptic curve points into multiple bucket points based on the sub-scalars corresponding to the multiple elliptic curve points, wherein, in the case where there are two elliptic curve points that need to be filled into the first bucket point, The two elliptic curve points are added to the primary storage sequence as a point to be added, and the first bucket point is any one of the multiple bucket points; a point addition operation module is used to execute the N point to be added in parallel based on SIMD instructions when there are N points to be added in the primary storage sequence, so as to obtain N first point addition results; a second bucket filling module is used to write the N first point addition results back to the corresponding bucket points; a bucket point aggregation module is used to perform bucket point aggregation after the elliptic curve points in multiple point multiplication operations of any of the sub-operation tasks are filled into the bucket points; an operation module is used to obtain the operation result of the original operation task based on the result of the bucket point aggregation of each of the sub-operation tasks.
[0012] Optionally, the second bucket filling module is also used to add the second point addition result and the point addition operation of the second bucket point as a pending point addition operation to the secondary storage sequence, the second point addition result is any one of the N first point addition results, and the second bucket point is the bucket point corresponding to the second point addition result; when there are at least N pending point addition operations in the secondary storage sequence, the first N pending point addition operations in the secondary storage sequence are executed in parallel based on SIMD instructions to obtain N third point addition results; based on the N third point addition results, the value of the corresponding bucket point is updated to achieve writing the N first point addition results back to the corresponding bucket point.
[0013] Optionally, in the secondary storage sequence, the first N pending point addition operations in the secondary storage sequence are executed in parallel once, indicating that one round of operations of the secondary storage sequence is completed. If there are at least two bucket points in the pending point addition operations in the secondary storage sequence of the I round of operations that are the third bucket points, any one of the multiple bucket points of the third bucket point, then the second bucket filling module is further used for: when there are K bucket points in the pending point addition operations in the secondary storage sequence of the I round of operations that are the third bucket points, K is greater than or equal to 2 and K is an even number, among the first point addition results of the K pending point addition operations, every two first point addition results are used as a pending point addition operation to construct 0.5K pending point addition operations in the secondary storage sequence of the I round of operations; after the I round of operations is completed, the operation results of the 0.5K pending point addition operations are respectively added to the secondary storage sequence with the third bucket point as a pending point addition operation, waiting for the I+1 round of operations; wherein I is a positive integer.
[0014] Optionally, the second bucket filling module is also used for, when there are K bucket points to be added in the secondary storage sequence of the I round of operation, which are the third bucket points, and K is greater than or equal to 2 and K is an odd number, taking every two first point addition results in the first K-1 points to be added as a point to be added, so as to construct 0.5 (K-1) points to be added in the secondary storage sequence of the I round of operation; after the I round of operation is completed, adding the operation results of the 0.5 (K-1) points to be added to the secondary storage sequence as a point to be added together with the third bucket point, waiting for the I+1 round of operation.
[0015] Optionally, the bucket point aggregation module is further used to implement bucket point aggregation for the j-th sub-computation task using the following formula:
[0016]
[0017] Among them, G j is the jth sub-computation task, B l Represents the lth bucket point, where l is an integer.
[0018] In a third aspect, a computer device is also provided, comprising: a memory and a processor, wherein at least one computer program is stored in the memory, and the at least one computer program is loaded and executed by the processor, thereby executing the multi-scalar multiplication method described in the above embodiment.
[0019] In a fourth aspect, a computer-readable storage medium is also provided, wherein at least one computer program is stored in the computer-readable storage medium, and the at least one computer program is loaded and executed by a processor to perform the multi-scalar multiplication method described in the above embodiment.
[0020] In a fifth aspect, a computer program product is provided, comprising a computer program / instruction, wherein when the computer program / instruction is executed by a processor, the method described in the first aspect is implemented.
[0021] The beneficial effects brought by the technical solution provided by the embodiments of the present disclosure include at least:
[0022] In the disclosed embodiment, the SIMD instruction set is used to implement the parallel execution of N point addition operations in multi-scalar multiplication, which effectively improves the operation efficiency of multi-scalar multiplication. In addition, the architecture in the disclosed embodiment is applicable to the CPU platform, so that multi-scalar multiplication is not limited to hardware such as FPGA or GPU, which effectively improves the universality of multi-scalar multiplication.
[0023] Multi-scalar multiplication is usually performed in projective coordinates. When performing point addition in projective coordinates, the z-coordinate values of the two points being added will affect the minimum number of operations for a single point addition. Suppose the coordinates of the two points being added are (x 1 ,y 1 , z 1 ) and (x2, y2, z 2 ), then, when z 1 =z 2 = 1, the addition operation of these two points requires at least 7 modular multiplication operations; when z 1 ≠1, z 2 = 1, the addition operation of these two points requires at least 11 modular multiplication operations; when z 1 ≠1, z 2 ≠1, the point addition operation of these two points requires at least 12 modular multiplication operations.
[0024] If we directly add the elliptic curve points corresponding to the two sub-scalars that need to be written into the first bucket point to the first bucket point in sequence, that is, first add one elliptic curve point to the first bucket point to update the value of the first bucket point, and then add another elliptic curve point to the updated first bucket point, this operation process is equivalent to performing z twice. 1 ≠1, z 2 = 1, that is, a total of 22 modular multiplication operations are required. In the embodiment of the present disclosure, by first adding the elliptic curve points corresponding to the two sub-scalars that need to be written into the first bucket point, this is equivalent to performing a z 1 =z 2 = 1, and then add the result of adding the two elliptic curve points to the first bucket point, which is equivalent to performing a z 1 ≠1, z 2≠1, so the total number of modular multiplication operations is 7 plus 12, that is, 19 modular multiplication operations, which is less than 22 modular multiplication operations. Therefore, the method in the embodiment of the present disclosure can reduce the number of modular multiplication operations of the midpoint addition operation in the multi-scalar multiplication, thereby speeding up the operation process of the multi-scalar multiplication. BRIEF DESCRIPTION OF THE DRAWINGS
[0025] In order to more clearly illustrate the technical solutions in the embodiments of the present disclosure, the drawings required for use in the description of the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present disclosure. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative work.
[0026] Figure 1 A flowchart of a multi-scalar multiplication method provided by an exemplary embodiment of the present disclosure is shown;
[0027] Figure 2 A flowchart of a multi-scalar multiplication method provided by another exemplary embodiment of the present disclosure is shown;
[0028] Figure 3 It is a schematic diagram of the operation process of the multi-scalar multiplication operation method;
[0029] Figure 4 It is a schematic diagram of the tree structure;
[0030] Figure 5 A schematic structural diagram of a multi-scalar multiplication operation device provided by an exemplary embodiment of the present disclosure is shown;
[0031] Figure 6 It is a schematic diagram of the structure of a computer device provided in an embodiment of the present disclosure. DETAILED DESCRIPTION
[0032] Unless otherwise defined, the technical or scientific terms used herein shall have the usual meanings understood by persons of ordinary skill in the field to which the present disclosure belongs. The words "first", "second", "third" and similar words used in the patent application specification and claims of the present disclosure do not indicate any order, quantity or importance, but are only used to distinguish different components. Similarly, words such as "one" or "one" do not indicate a quantitative limitation, but rather indicate the presence of at least one. Words such as "include" or "comprise" and similar words mean that the elements or objects appearing before "include" or "comprise" cover the elements or objects listed after "include" or "comprise" and their equivalents, and do not exclude other elements or objects. Words such as "connect" or "connected" and similar words are not limited to physical or mechanical connections, but may include electrical connections, whether direct or indirect.
[0033] In order to make the objectives, technical solutions and advantages of the present disclosure more clear, the embodiments of the present disclosure will be further described in detail below with reference to the accompanying drawings.
[0034] Figure 1 A flowchart of a multi-scalar multiplication method provided by an exemplary embodiment of the present disclosure is shown. The method can be executed by a CPU. Figure 1 , the method comprising:
[0035] In step 101, the original operation task of large-scale elliptic curve multi-scalar multiplication is divided into multiple sub-operation tasks.
[0036] Each sub-operation task includes multiple point multiplication operations, each point multiplication operation includes a sub-scalar and an elliptic curve point, and the elliptic curve point in each point multiplication operation corresponds to the sub-scalar. Each sub-operation task is a small multi-scalar multiplication operation.
[0037] For example, the original computation task can be expressed as:
[0038]
[0039] In formula (1), Q is the original operation task, n is the scale of multi-scalar multiplication, that is, the total number of calculations, and k is i is the i-th scalar, each scalar belongs to a finite field, P i Represents the i-th elliptic curve point, and all elliptic curve points are on the elliptic curve. Where i is an integer, 1≤i≤n.
[0040] In this case, step 101 includes: under the premise of binary, assuming that each scalar is a λ-bit scalar (λ is usually 256 or 512, etc.), then each scalar can be divided into parts, each part is a sub-scalar of the scalar value. Among them, s is the size of the window of the Pippenger algorithm, and the value of s is usually 4, that is, for any scalar, every 4 bits of the scalar are divided into a sub-scalar.
[0041] For example, a scalar is 234, and the binary representation of 234 is 11101010. At this time, the value of λ is 8. When the value of s is 4, the scalar value can be divided into two sub-scalars, namely 1110 and 1010. Converting these two sub-scalars into decimal is 14 and 10.
[0042] In this case, each sub-computation task can be expressed by formula (2).
[0043]
[0044] In formula (2), Gj is the jth sub-computation task, m ij is the jth subscalar of the i-th scalar, where j is an integer The meanings of other parameters in formula (2) are the same as those in formula (1), and detailed description is omitted here.
[0045] From formula (2), we can see that each sub-operation task includes multiple point multiplication operations, for example, 1j P 1 、m 2j P 2 ……m nj P n In these multiple point multiplication operations, each point multiplication operation includes a subscalar and an elliptic curve point. Therefore, the subscalar and the elliptic curve point in each point multiplication operation correspond to each other.
[0046] In step 102, the plurality of elliptic curve points are filled into a plurality of bucket points based on the sub-scalars corresponding to the plurality of elliptic curve points.
[0047] If two elliptic curve points are filled in the first bucket point, the two elliptic curve points are added to the primary storage sequence as a point to be added, and the first bucket point is any one of the multiple bucket points.
[0048] Here, Bucket is the name of the storage unit of an elliptic curve point.
[0049] In multiple point multiplication operations of a sub-operation task, each bucket point corresponds to the decimal value of the sub-scalar. If the decimal value of the sub-scalar in a point multiplication operation is a, then the elliptic curve point in the point multiplication operation needs to be filled in the bucket point B. a For example, in a point multiplication operation, if the decimal value of the subscalar corresponding to a certain elliptic curve point is 1, then the elliptic curve point needs to be filled into bucket point B. 1 .
[0050] When performing calculations, the calculations are performed in the order of the sub-calculation tasks, and each sub-calculation task includes multiple point multiplication operations. Therefore, the actual calculation order is to perform the calculations in the order of the multiple point multiplication operations in the multiple sub-calculation tasks.
[0051] In step 103, when there are N pending point addition operations in the primary storage sequence, the N pending point addition operations are executed in parallel based on SIMD instructions to obtain N first point addition results.
[0052] The SIMD (Single Instruction Multiple Data) instruction set is an operation instruction set on a CPU platform. Based on the instructions in the SIMD instruction set, it is possible to use a set of instructions to perform parallel operations on multiple sets of data. Therefore, based on SIMD instructions, multiple point addition operations can be performed in parallel on a CPU platform. Exemplarily, the SIMD instruction set in the embodiments of the present disclosure may be an AVX-512 (Advanced Vector Extensions-512) instruction.
[0053] There are many related technologies for implementing parallel computing based on SIMD instructions, and detailed description is omitted here.
[0054] In the embodiment of the present disclosure, N can be 4 or 8.
[0055] In step 104, the N first point addition results are written back to the corresponding bucket points.
[0056] In step 105, after all elliptic curve points in multiple point multiplication operations of any sub-operation task are filled into bucket points, bucket point aggregation is performed.
[0057] Bucket point aggregation means that after all elliptic curve points involved in a sub-computation task are filled into the bucket points, the calculation result of the sub-computation task is determined based on the current values of multiple bucket points.
[0058] In step 106, based on the result of bucket point aggregation of each sub-computing task, the computing result of the original computing task is obtained.
[0059] In the disclosed embodiment, the SIMD instruction set is used to implement the parallel execution of N point addition operations in multi-scalar multiplication, which effectively improves the operation efficiency of multi-scalar multiplication. In addition, the architecture in the disclosed embodiment is applicable to the CPU platform, so that multi-scalar multiplication is not limited to hardware such as FPGA or GPU, which effectively improves the universality of multi-scalar multiplication.
[0060] Multi-scalar multiplication is usually performed in projected coordinates. When performing point addition in projected coordinates, the values of the z coordinates of the two points being added will affect the minimum number of operations for a single point addition. Suppose the coordinates of the two points being added are (x 1 ,y 1 , z 1 ) and (x 2 ,y 2 , z 2 ), then, when z 1 =z 2 = 1, the addition operation of these two points requires at least 7 modular multiplication operations; when z1 ≠1, z 2 = 1, the addition operation of these two points requires at least 11 modular multiplication operations; when z 1 ≠1, z 2 ≠1, at least 12 modular multiplication operations are required to perform the point addition operation on these two points.
[0061] If we directly add the elliptic curve points corresponding to the two sub-scalars that need to be written into the first bucket point to the first bucket point in sequence, that is, first add one elliptic curve point to the first bucket point to update the value of the first bucket point, and then add another elliptic curve point to the updated first bucket point, this operation process is equivalent to performing z twice. 1 ≠1, z 2 = 1, that is, a total of 22 modular multiplication operations are required. In the embodiment of the present disclosure, by first adding the elliptic curve points corresponding to the two sub-scalars that need to be written into the first bucket point, this is equivalent to performing a z 1 =z 2 = 1, and then add the result of adding the two elliptic curve points to the first bucket point, which is equivalent to performing a z 1 ≠1, z 2 ≠1, so the total number of modular multiplication operations is 7 plus 12, that is, 19 modular multiplication operations, which is less than 22 modular multiplication operations. Therefore, the method in the embodiment of the present disclosure can reduce the number of point addition operations in multi-scalar multiplication, thereby speeding up the operation process of multi-scalar multiplication.
[0062] Figure 2 A flowchart of a multi-scalar multiplication method provided by another exemplary embodiment of the present disclosure is shown. The method can be executed by a CPU. Figure 2 , the method comprising:
[0063] In step 201, the original operation task of large-scale elliptic curve multi-scalar multiplication is divided into multiple sub-operation tasks.
[0064] The relevant contents of step 201 refer to the aforementioned step 101, and the detailed description is omitted here.
[0065] In step 202, multiple elliptic curve points are filled into multiple bucket points based on sub-scalars corresponding to the multiple elliptic curve points.
[0066] When implementing step 202, a scalar-elliptic curve point table may be established based on the sequence of multiple point multiplication operations in each sub-operation task.
[0067] Exemplarily, there may be multiple tables of scalar-elliptic curve points, each table being used to represent multiple point multiplication operations in one sub-operation task.
[0068] The table of scalar-elliptic curve points includes two data types, one data type is scalar, which is used to store the value of the sub-scalar in the point multiplication operation, and the other data type is elliptic curve point, which is used to store the elliptic curve point in the point multiplication operation. In the scalar-elliptic curve point table, if the value of a sub-scalar and an elliptic curve point are in the same row, it means that the sub-scalar and the elliptic curve need to be multiplied.
[0069] For example, a table of scalar-elliptic curve points is used to represent the sub-operation task G 1 If there are multiple point multiplication operations in m 11 P 1 、m 21 P 2 ……m n1 P n Fill them into the scalar-elliptic curve point table in sequence.
[0070] In the case of a scalar-elliptic curve point table, a Bucket table and a DoublePoint table can be created, where the Bucket table is used to store all bucket point values, and the DoublePoint table is used to store two elliptic curve points that need to be filled into the Bucket table.
[0071] The Bucket table includes three data types: bucket point number, bucket point, and link pointer. The Double Point table includes bucket point number, count, and two data types for storing elliptic curve points.
[0072] The bucket point number corresponds to the bucket point, and the bucket point number of a bucket point is the value of the sub-scalar corresponding to the bucket point. 1 The bucket point number is 1, indicating that the elliptic curve points of the point multiplication operation with a subscalar of 1 need to be written to bucket point B 1 .
[0073] The Link pointer is used to link a row in the Double Point table. When there is no elliptic curve point to be written in a bucket point, the Link pointer of the bucket point is empty.
[0074] When the Link pointer of the bucket point is empty, if the bucket point has a new elliptic curve point A that needs to be written, an empty table entry is found in the Double Point table, and the elliptic curve point A is written to the corresponding data type in the empty table entry. The table entry is used to store the elliptic curve point A that needs to be written and the bucket point number of the bucket point. Here, an empty table entry is a row in the Double Point table that has no data filled in. In the Double Point table, the number of table entries is fixed, and an appropriate number of table entries in the Double Point table can be set according to the scale of multi-scalar multiplication, thereby ensuring that there are always empty table entries in the Double Point table, avoiding the situation where no empty table entries can be found in the Double Point table.
[0075] When the Link pointer of the bucket point is not empty and there is only one elliptic curve point A in a row in the Double Point table pointed to by the Link pointer, if the bucket point has a new elliptic curve point B that needs to be written, the elliptic curve point B is also written into the corresponding data type in the row. At this time, the Link pointer of the bucket point is cleared, and the elliptic curve point A and the elliptic curve point B in the row form a point to be added.
[0076] The count in the Double Point table is used to count the number of elliptic curve points that need to be written to a bucket point. The count can be named cnt. For any row in the Double Point table, if there is only one elliptic curve point in the row, cnt is 1, and if there are two elliptic curve points in the row, cnt is 2.
[0077] When an elliptic curve point needs to be written to the first bucket point, the conventional practice is to directly add the value of the first bucket point to the elliptic curve point; however, in the disclosed embodiment, when an elliptic curve point needs to be written to the first bucket point, first determine whether there is another elliptic curve point to be written in the first bucket point (this can be determined by whether the Link pointer is empty). If there is another elliptic curve point to be written (that is, the Link pointer is not empty), then the elliptic curve point and the other elliptic curve point constitute a pending point addition operation, which can be subsequently added to the primary storage sequence.
[0078] The two data types for storing elliptic curve points in the Double Point table are P1 and P2. If two elliptic curve points are located in the same row of data type P1 and data type P2 in the Double Point table, it means that the two elliptic curve points are a point to be added.
[0079] Combine the following Figure 3The data changes of the scalar-elliptic curve point table, Bucket table and Double Point table during the calculation process are explained.
[0080] Figure 3 It is a schematic diagram of the operation process of the multi-scalar multiplication operation method, such as Figure 3 As shown in the figure, during the operation, the elliptic curve points are filled into the bucket points in the order in the scalar-elliptic curve point table. Figure 3 The scalar-elliptic curve point table in is the first scalar-elliptic curve point table, and at this time both the Bucket table and the Double Point table are empty.
[0081] Since the elliptic curve point P 1 The corresponding subscalar is 1, so firstly the elliptic curve point P 1 Fill to bucket point B 1 In the filling, first determine the bucket point B 1 The corresponding Link pointer is empty. It must be empty in the initial state. Therefore, a Link pointer is created at this time. The Link pointer points to the first row in the Double Point table (the first row is also blank), and the bucket point number in the first row is set to 1, the count cnt is set to 1, and the elliptic curve point P is 1 Fill in the data type P1 in the Double Point table.
[0082] Then for the fourth row in the scalar-elliptic curve point table (the second and third rows are omitted), the elliptic curve point P 4 The corresponding subscalar is also 1, which is the elliptic curve point P 4 It also needs to be filled in to bucket point B 1 In the elliptic curve point P 4 When, first determine the bucket point B 1 Whether the corresponding Link pointer is empty, due to the elliptic curve point P 1 The existence of, at this time bucket point B 1 The corresponding Link pointer is not empty. At this time, the count cnt in the row of the Link pointer (that is, the first row) can be set to 2, and the elliptic curve point P 4 Fill in the data type P2 in the Double Point table, and then clear B 1 The corresponding Link pointer.
[0083] The first-level storage sequence can be named L1_Input. The first-level storage sequence is an array of length N, that is, the first-level storage sequence includes N pointers. When the count cnt in a row in the Double Point table is 2, an idle pointer in the first-level storage sequence is pointed to the row, that is, the waiting point addition operation in the row is added to the first-level storage sequence.
[0084] When N numbers in the primary storage sequence point to N rows in the Double Point table, that is, when there are N points to be added in the primary storage sequence, step 203 is executed. The value of N is related to the aforementioned step 103, and the detailed description is omitted here.
[0085] In step 203, N pending point addition operations are executed in parallel based on SIMD instructions to obtain N first point addition results.
[0086] The method of first adding two elliptic curve points that need to be written into the same bucket point and then writing the addition result back to the bucket point in the embodiment of the present disclosure can be called a tree structure in a point addition operation.
[0087] Figure 4 is a schematic diagram of the tree structure, such as Figure 4 As shown in the figure, the first row is the sub-scalar, the second row is the elliptic curve point corresponding to the sub-scalar, and the last row is the bucket point. It can be seen that this operation method is similar to the shape of a binary tree, so it can be called a tree structure. By adopting a tree structure, the number of operations in the multi-scalar multiplication process can be reduced, and the operation process of multi-scalar multiplication can be accelerated.
[0088] Optionally, the tree structure can also be applied between the scalar-elliptic curve point table and the Bucket table. Figure 3 As an example, the scalar-elliptic curve point table in , the elliptic curve point P 2 and P 3 All need to be written to bucket point B 3 , we can use the tree structure to first 2 and P 3 Use SIMD instructions to perform a point addition, and then add P 2 and P 3 The result after adding points is filled into bucket point B 3 , that is, P 2 and P 3 The result of point addition is filled into the data type P1 in the second row of the Double Point table; similarly, the elliptic curve point P 5 and P 6 It also needs to be written to bucket point B 3 , we can use the tree structure to first 5 and P 6Use SIMD instructions to perform a point addition, and then add P 5 and P 6 The result after adding points is filled into bucket point B 3 , that is, P 5 and P 6 The result of the point addition is filled into the data type P2 in the second row of the DoublePoint table. The following steps are performed in the manner of step 202.
[0089] The N first point addition results in step 203 need to be written back to the bucket points, that is, the N first point addition results need to be added to the corresponding bucket points respectively. Therefore, the N first point addition results need to be temporarily stored first, and then the N first point addition results and the corresponding bucket points are added.
[0090] The N first point addition results can be temporarily stored in the first output queue, which can be named L1_Output. The first output queue is also an array with a length of N. Each first point addition result in the first output queue corresponds to a point addition operation to be performed in the first-level storage sequence.
[0091] In step 204, the N first point addition results are written back to the corresponding bucket points.
[0092] Optionally, step 204 includes the following steps ac:
[0093] Step a: for the second point addition result, the point addition operation of the second point addition result and the second bucket point is added to the secondary storage sequence as a pending point addition operation.
[0094] The second point addition result is any one of the N first point addition results, and the second bucket point is the bucket point corresponding to the second point addition result.
[0095] In the disclosed embodiment, the secondary storage sequence is a circular queue of uncertain size, and the secondary storage sequence can be represented by L2_Input. The secondary storage sequence includes four data types: bucket point label, op1, op2 and out. The bucket point label is used to indicate which bucket point the elliptic curve point in op1 is used to write; op1 is used to store elliptic curve points, and op2 is used to store elliptic curve points or bucket points. If two values are located in op1 and op2 in the same column, it means that the two values need to be added.
[0096] out includes 1 and 0. When the out of a column is 1, it means that the value of op1 and op2 in the column after point addition needs to be updated to the bucket point indicated by the bucket point label of the column; when out is 0, it means that the value of op1 and op2 in the column after point addition needs to be added to the secondary storage sequence.
[0097] When executing the first step, it may happen that among the N first point addition results, there are at least two bucket points in the waiting point addition operation that are the same, both of which are the third bucket points, indicating that a bucket point conflict has occurred. In this case, the following first to second steps or third to fourth steps are used for processing. Among them, the third bucket point is any one of the multiple bucket points:
[0098] The first step is that when there are K bucket points in the secondary storage sequence of the I round of operations that are the third bucket points, and K is greater than or equal to 2 and K is an even number, among the first point addition results of the K pending point addition operations, every two first point addition results are used as a pending point addition operation to construct 0.5K pending point addition operations in the secondary storage sequence of the I round of operations.
[0099] In the embodiment of the present disclosure, in the secondary storage sequence, the first N waiting-point addition operations in the secondary storage sequence are executed in parallel once, which means that one round of operations of the secondary storage sequence is completed.
[0100] The first round of operation here can be any round of operation in the secondary storage sequence. I can be a positive integer, and the embodiment of the present disclosure does not limit the value range of I.
[0101] For example, in the first round of operations, K is equal to 4, that is, there are 4 first point addition results that need to be written back to the third bucket point, assuming that these 4 first point addition results are C, D, E, and F. Originally, according to the first step, there should be 4 pending point addition operations, namely, C, D, E, F and the pending point addition operations of the third bucket point, but in this case, there will be 4 values that need to be updated to the third bucket point later, that is, there is a bucket point conflict. At this time, the original 4 pending point addition operations are changed into two pending point addition operations, that is, C and D constitute one pending point addition operation, and E and F constitute one pending point addition operation. Thus, 0.5K (that is, 2) pending point addition operations are constructed in the first round of operations.
[0102] In the second step, after the I round of operations is completed, the operation results of the 0.5K pending point addition operations are added to the secondary storage sequence together with the third bucket point as a pending point addition operation, waiting for the I+1 round of operations.
[0103] Here, the second step constructs 0.5K pending point addition operations with the third bucket points. If 0.5K is not 1, then these 0.5K pending point addition operations with the third bucket points in the I+1th round of operations also need to repeat the first step above, and so on, until there is only one pending point addition operation with the third bucket points in a certain round of operations.
[0104] When there are K bucket points to be added in the secondary storage sequence of the Ith round of operation, which are the third bucket points, K is greater than or equal to 2 and K is an odd number, execute the following third step to fourth step.
[0105] The third step is to use every two first point addition results in the first K-1 pending point addition operations as a pending point addition operation to construct 0.5 (K-1) pending point addition operations in the secondary storage sequence of the Ith round of operations.
[0106] The essence of the third step is to process the first K-1 pending point addition operations as the case when K is an even number, while keeping the last pending point addition operation unchanged.
[0107] The fourth step is to add the results of the 0.5(K-1) pending point addition operations and the third bucket point as a pending point addition operation to the secondary storage sequence after the I round of operations is completed, waiting for the I+1 round of operations.
[0108] The principles of step 3 to step 4 are similar to those of step 1 to step 2, and detailed description is omitted here.
[0109] For example, K is equal to 3, which means there are 3 first point addition results that need to be written back to the third bucket point. Assume that these 3 first point addition results are C, D, and E. Originally, according to the first step, there should be 3 pending point addition operations, namely C, D, E and the third bucket point. At this time, the pending point addition operation of E and the third bucket point can be kept unchanged. For the pending point addition operation of C and D and the third bucket point, it is equivalent to K being an even number, and the first to second steps mentioned above can be executed.
[0110] In summary, when the bucket point among the K pending point addition operations is the third bucket point, if K is an even number, the K pending point addition operations in the current secondary storage sequence are divided into 0.5K pending point addition operations; if K is an odd number, the K pending point addition operations in the secondary storage sequence are divided into 0.5(K-1)+1 pending point addition operations. The +1 here is the last pending point addition operation among the reserved K pending point addition operations.
[0111] Optionally, whether there is a bucket point conflict may be determined by querying whether there is an identical label in the secondary storage sequence.
[0112] Step b: when there are at least N pending point addition operations in the secondary storage sequence, the first N pending point addition operations in the secondary storage sequence are executed in parallel based on SIMD instructions to obtain N third point addition results.
[0113] The length of the secondary storage sequence is not fixed. When the length of the pending point addition operations in the secondary storage sequence is greater than or equal to N, the second step is executed to execute the first N pending point addition operations.
[0114] Step c: based on the N third point addition results, update the value of the corresponding bucket point to write the N first point addition results back to the corresponding bucket point.
[0115] In implementation, the N third point addition results can be stored in the second output queue, which can be named L2_Output. The second output queue is also an array with a length of N.
[0116] In the embodiment of the present disclosure, when updating the value of the corresponding bucket point, only the third point addition result corresponding to the column with out being 1 in the secondary storage sequence can be updated to the corresponding bucket point.
[0117] Combine the following Figure 3 The operation process of the primary storage sequence and the secondary storage sequence is explained. Figure 3 In the example, N is equal to 8. When there are 8 pending addition operations in the first-level storage sequence L1_Input, these 8 pending addition operations are executed in parallel based on SIMD instructions to obtain R 1 , R 2 , R 3 , R 4 , R 5 , R 6 , R 7 and R 8 These 8 first point addition results are stored in the first output queue L1_Output.
[0118] Then fill the eight first point addition results into the secondary storage sequence L2_Input. When filling in, due to R 1 is P in the first row of the Double Point table 1 and P 4 Therefore, the first point addition result R is filled in the secondary storage sequence L2_Input. 1 When the first point plus the result R 1 The bucket point in the column (that is, the first column) is labeled 1, and op1 is R 1 , and since only the first point addition result R among the 8 first point addition results 1 Need to write back to bucket point B 1 , so op2 is B 1 , out is 1, and when the subsequent operation is performed, the result of adding the third point of the column is T 1 .
[0119] R 2 It is P in the second row of the Double Point table. 2 and P 3 The point addition result, R 3 It is P in the second row of the Double Point table. 5 and P 6 The point addition result is R 2 and R 3 All need to be written back to bucket point B3 At this time, there is a bucket point conflict between the original second and third columns in the secondary storage sequence. The original second and third columns are deleted, and a new column consisting of R is constructed at the position of the original second column. 2 and R 3 In the second column, the bucket point number is 3, op1 is R 2 , op2 is R 3 , out is 0, indicating that the output result of the second column cannot be updated to the bucket point, but needs to be filled into the secondary storage sequence for subsequent processing.
[0120] Here, R 2 and R 3 The two items show that K is equal to 2, which means 0.5K is equal to 1, so in R 2 and R 3 After the waiting point addition operation is completed, the third point addition result T 2 Can be with bucket point B 3 A waiting point addition operation is formed and added to the secondary storage sequence. 2 and B 3 When adding to the secondary storage sequence, the bucket point number is still 3, and op1 is T 2 , op2 is B 3 , and out is 1, indicating that the output result of the waiting point addition operation can be updated to bucket point B 3 .
[0121] In the disclosed embodiment, for the Double Point table, when the operation in a row is completed in the primary storage sequence, the content in the row can be cleared, so as to save the storage space of the Double Point table. For the primary storage sequence, when the N pending point addition operations in the primary storage sequence are all completed and the N first operation results are all filled into the first output queue, the primary storage sequence can be cleared. For the first output queue, when the N first operation results in the first output queue are all filled into the secondary storage sequence, the first output queue can be cleared. For the secondary storage sequence, the column where the pending point addition operation is completed can be cleared. For the second output queue, after the N third operation results are all processed (for example, part of the third operation results are updated to the bucket point, and part of the third operation results are filled into the secondary storage sequence), the second output queue can be cleared.
[0122] By repeatedly performing the above steps 202 to 204 for the bucket filling operation of a certain sub-computation task, the elliptic curve points involved in the sub-computation task can be filled into the bucket points corresponding to the sub-scalar.
[0123] When all the elliptic curve points involved in the sub-operation task are filled into the bucket points, there may be a situation where the number of points to be added in the primary storage sequence and the secondary storage sequence is less than N. Since all the elliptic curve points involved in the sub-operation task have been filled into the bucket points, no more points to be added will be added to the primary storage sequence and the secondary storage sequence in the future. At this time, it is in the closing stage of the sub-operation task. In the closing stage, for the primary storage sequence and the secondary storage sequence where the number of points to be added is less than N, the above steps 202-204 are also executed once, and the unsatisfied part can be run empty, thereby completing the closing stage of the sub-operation task.
[0124] After the end phase of the sub-computation task is completed, the value of each bucket point will no longer change, and step 205 can be executed for the sub-computation task.
[0125] In step 205, after all elliptic curve points in multiple point multiplication operations of any sub-operation task are filled into bucket points, bucket point aggregation is performed.
[0126] The relevant contents of the bucket point aggregation refer to the aforementioned step 105, and the detailed description is omitted here. The process of bucket point aggregation of the j-th sub-computation task can be expressed by formula (3).
[0127]
[0128] In formula (3), B l Represents the lth bucket point, l is an integer, 1≤l≤2 s The meanings of other parameters in formula (3) are the same as those in formula (2), and detailed description is omitted here.
[0129] The bucket point aggregation result of the j-th sub-computation task is also the calculation result of the j-th sub-computation task.
[0130] By executing the above steps 201 to 205 for each sub-computation task, the calculation result of each sub-computation task can be obtained.
[0131] In step 206, the operation result of the original operation task is obtained based on the operation result of each sub-operation task.
[0132] Step 206 can be implemented by the following formula (4) to formula (5).
[0133]
[0134] In formula (4), M j is an intermediate quantity, which is calculated by formula (5). The meanings of other parameters in formula (4) are the same as those of the relevant parameters in formula (1) and step 101, and detailed description is omitted here.
[0135] M j =2 (j-1)s G j (5)
[0136] The meanings of the parameters in formula (5) are the same as those of the relevant parameters in formula (3) and step 101, and detailed description is omitted here.
[0137] The multi-scalar multiplication in the disclosed embodiment can be applied to zero-knowledge proof, thereby improving the efficiency of zero-knowledge proof, and has broad application prospects in the fields of digital currency, privacy protection, smart contracts, etc.
[0138] In the disclosed embodiment, the tree structure is used to improve the computational efficiency of multi-scalar multiplication. In addition, the architecture in the disclosed embodiment is applicable to the CPU platform, so that multi-scalar multiplication is not limited to hardware such as FPGA or GPU, which effectively improves the universality of multi-scalar multiplication.
[0139] The following are device embodiments of the present application. For details not described in detail in the device embodiments, reference may be made to the above method embodiments.
[0140] Figure 5 FIG. 1 shows a schematic diagram of a multi-scalar multiplication operation device provided by an exemplary embodiment of the present disclosure, see Figure 5 The multi-scalar multiplication operation device 500 includes: a segmentation module 501, a first bucket filling module 502, a point addition operation module 503, a second bucket filling module 504, a bucket point aggregation module 505 and an operation module 506.
[0141] The splitting module 501 is used to split the original operation task of large-scale elliptic curve multi-scalar multiplication into multiple sub-operation tasks, each sub-operation task includes multiple point multiplication operations, each point multiplication operation includes a sub-scalar and an elliptic curve point, and the elliptic curve point in each point multiplication operation corresponds to the sub-scalar.
[0142] The first bucket filling module 502 is used to fill multiple elliptic curve points into multiple bucket points based on the sub-scalars corresponding to the multiple elliptic curve points. In the case that there are two elliptic curve points that need to be filled into the first bucket point, the two elliptic curve points are added to the primary storage sequence as a point to be added, and the first bucket point is any one of the multiple bucket points.
[0143] The point addition operation module 503 is used to execute the N pending point addition operations in parallel based on SIMD instructions when there are N pending point addition operations in the primary storage sequence to obtain N first point addition results.
[0144] The second bucket filling module 504 is used to write the N first point addition results back to the corresponding bucket points.
[0145] The bucket point aggregation module 505 is used to perform bucket point aggregation after all elliptic curve points in multiple point multiplication operations of any sub-operation task are filled into the bucket points.
[0146] The operation module 506 is used to obtain the operation result of the original operation task based on the result of the bucket point aggregation of each sub-operation task.
[0147] Optionally, the second bucket filling module 504 is also used to add the second point addition result and the point addition operation of the second bucket point as a pending point addition operation to the secondary storage sequence, the second point addition result is any one of the N first point addition results, and the second bucket point is the bucket point corresponding to the second point addition result; when there are at least N pending point addition operations in the secondary storage sequence, the first N pending point addition operations in the secondary storage sequence are executed in parallel based on SIMD instructions to obtain N third point addition results; based on the N third point addition results, the values of the corresponding bucket points are updated to achieve writing the N first point addition results back to the corresponding bucket points.
[0148] Optionally, in the secondary storage sequence, the first N pending point addition operations in the secondary storage sequence are executed in parallel once, indicating that one round of operations of the secondary storage sequence is completed. If there are at least two bucket points in the pending point addition operations in the secondary storage sequence of the I round of operations that are the third bucket points, any one of the multiple bucket points of the third bucket point, then the second bucket filling module 504 is also used for: when there are K bucket points in the pending point addition operations in the secondary storage sequence of the I round of operations that are the third bucket points, K is greater than or equal to 2 and K is an even number, among the first point addition results of the K pending point addition operations, every two first point addition results are used as a pending point addition operation to construct 0.5K pending point addition operations in the secondary storage sequence of the I round of operations; after the I round of operations is completed, the operation results of the 0.5K pending point addition operations are respectively added to the secondary storage sequence with the third bucket point as a pending point addition operation, waiting for the I+1 round of operations; wherein I is a positive integer.
[0149] Optionally, the second bucket filling module 504 is also used to, when there are K bucket points to be added in the secondary storage sequence of the I round of operations, which are the third bucket points, and K is greater than or equal to 2 and K is an odd number, use every two first point addition results in the first K-1 points to be added as a point to be added, so as to construct 0.5 (K-1) points to be added in the secondary storage sequence of the I round of operations; after the I round of operations is completed, add the results of the 0.5 (K-1) points to be added to the secondary storage sequence as a point to be added, respectively, together with the third bucket point, to wait for the I+1 round of operations.
[0150] Optionally, the bucket point aggregation module 505 is further configured to implement bucket point aggregation for the j-th sub-computation task using the following formula:
[0151]
[0152] Among them, G j is the jth sub-computation task, B l Represents the lth bucket point, where l is an integer.
[0153] It should be noted that: when the multi-scalar multiplication operation device provided in the above embodiment performs multi-scalar multiplication operation, only the division of the above functional modules is used as an example. In actual application, the above functions can be assigned to different functional modules as needed, that is, the internal structure of the device is divided into different functional modules to complete all or part of the functions described above. In addition, the multi-scalar multiplication operation device provided in the above embodiment and the multi-scalar multiplication operation method embodiment belong to the same concept. The specific implementation process is detailed in the method embodiment and will not be repeated here.
[0154] The division of modules in the embodiments of the present disclosure is schematic and is only a logical function division. There may be other division methods in actual implementation. In addition, each functional module in each embodiment of the present disclosure may be integrated into a processor, or may exist physically separately, or two or more modules may be integrated into one module. The above-mentioned integrated modules may be implemented in the form of hardware or in the form of software functional modules.
[0155] If the integrated module is implemented in the form of a software function module and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present disclosure is essentially or the part that contributes to the prior art or all or part of the technical solution can be embodied in the form of a software product, and the computer software product is stored in a storage medium, including a number of instructions to enable a terminal device (which can be a personal computer, a mobile phone, or a communication device, etc.) or a processor (processor) to perform all or part of the steps of the method of each embodiment of the present disclosure. The aforementioned storage medium includes: U disk, mobile hard disk, read-only memory (ROM), random access memory (RAM), disk or optical disk and other media that can store program code.
[0156] Figure 6 Schematic diagram of the structure of the computer device provided by the embodiment of the present disclosure. Figure 6 As shown, the computer device 600 includes: a processor 601 and a memory 602 .
[0157] The processor 601 may include one or more processing cores, such as a 4-core processor, an 8-core processor, etc. The processor 601 may also include a main processor and a coprocessor. The main processor is a processor for processing data in the awake state, also known as a CPU; the coprocessor is a low-power processor for processing data in the standby state. In some embodiments, the processor 601 may also include an AI (Artificial Intelligence) processor, which is used to process computing operations related to machine learning.
[0158] The memory 602 may include one or more computer-readable storage media, which may be non-transitory. The memory 602 may also include a high-speed random access memory, and a non-volatile memory, such as one or more disk storage devices, flash memory storage devices. In some embodiments, the non-transitory computer-readable storage medium in the memory 602 is used to store at least one instruction, which is used to be executed by the processor 601 to implement the multi-scalar multiplication operation method provided in the embodiment of the present disclosure.
[0159] Those skilled in the art will understand that Figure 6 The structure shown in the figure does not constitute a limitation on the computer device 600, and the computer device 600 may include more or less components than those shown in the figure, or combine some components, or adopt a different arrangement of components.
[0160] The embodiment of the present disclosure also provides a non-temporary computer-readable storage medium. When the instructions in the storage medium are executed by a processor of a computer device, the computer device is enabled to perform the multi-scalar multiplication operation method provided in the embodiment of the present disclosure.
[0161] The embodiments of the present disclosure also provide a computer program product, including a computer program / instruction, which implements the multi-scalar multiplication operation method provided in the embodiments of the present disclosure when the computer program / instruction is executed by a processor.
[0162] The above description is only an optional embodiment of the present disclosure and is not intended to limit the present disclosure. Any modifications, equivalent substitutions, improvements, etc. made within the spirit and principles of the present disclosure shall be included in the protection scope of the present disclosure.
Claims
1. A multi-scalar multiplication method, characterized in that: The method is used to accelerate the operation process of the multi-scalar multiplication on a central processing unit (CPU) platform, and the method comprises: The original operation task of large-scale elliptic curve multi-scalar multiplication is divided into a plurality of sub-operation tasks, each of the sub-operation tasks includes a plurality of point multiplication operations, each of the point multiplication operations includes a sub-scalar and an elliptic curve point, and the elliptic curve point in each of the point multiplication operations corresponds to the sub-scalar; Based on the subscalars corresponding to the multiple elliptic curve points, the multiple elliptic curve points are filled into multiple bucket points, wherein, in the case where there are two elliptic curve points that need to be filled into the first bucket point, the two elliptic curve points are added to the primary storage sequence as a point to be added, and the first bucket point is any one of the multiple bucket points; When there are N pending point addition operations in the primary storage sequence, the N pending point addition operations are executed in parallel based on SIMD instructions to obtain N first point addition results; Write the N first point addition results back to the corresponding bucket points; After all elliptic curve points in the multiple point multiplication operations of any of the sub-operation tasks are filled into the bucket points, bucket point aggregation is performed; Based on the result of bucket point aggregation of each of the sub-computing tasks, the computing result of the original computing task is obtained.
2. The method according to claim 1, characterized in that Writing the N first point addition results back to corresponding bucket points includes: For the second point addition result, adding the second point addition result and the point addition operation of the second bucket point as a pending point addition operation to the secondary storage sequence, wherein the second point addition result is any one of the N first point addition results, and the second bucket point is the bucket point corresponding to the second point addition result; When there are at least N pending point addition operations in the secondary storage sequence, the first N pending point addition operations in the secondary storage sequence are executed in parallel based on SIMD instructions to obtain N third point addition results; Based on the N third point addition results, the values of the corresponding bucket points are updated to achieve writing the N first point addition results back to the corresponding bucket points.
3. The method according to claim 2, characterized in that In the secondary storage sequence, the first N waiting-point addition operations in the secondary storage sequence are executed in parallel once, indicating that one round of operations of the secondary storage sequence is completed. If there are at least two bucket points to be added in the secondary storage sequence of the first round of operation, which are the third bucket points, any one of the plurality of bucket points of the third bucket point, then writing the N first point addition results back to the corresponding bucket points includes: When there are K bucket points in the waiting point addition operation in the secondary storage sequence of the first round of operation that are the third bucket points, K is greater than or equal to 2 and K is an even number, among the first point addition results in the K waiting point addition operations, every two first point addition results are used as a waiting point addition operation, so as to construct 0.5K waiting point addition operations in the secondary storage sequence of the first round of operation; After the I round of operations is completed, the operation results of the 0.5K waiting point addition operations are added to the secondary storage sequence together with the third bucket point as a waiting point addition operation, waiting for the I+1 round of operations; Wherein, I is a positive integer.
4. The method according to claim 3, characterized in that Writing the N first point addition results back to the corresponding bucket points also includes: When there are K bucket points in the waiting point addition operation in the secondary storage sequence of the first round of operation that are the third bucket points, K is greater than or equal to 2 and K is an odd number, among the first point addition results in the first K-1 waiting point addition operations, every two first point addition results are used as a waiting point addition operation, so as to construct 0.5(K-1) waiting point addition operations in the secondary storage sequence of the first round of operation; After the Ith round of operations is completed, the operation results of the 0.5(K-1) pending point addition operations are added to the secondary storage sequence together with the third bucket point as a pending point addition operation, waiting for the I+1th round of operations.
5. The method according to any one of claims 1 to 4, characterized in that: After all the elliptic curve points in the multiple point multiplication operations of any of the sub-operation tasks are filled into the bucket points, bucket point aggregation is performed, including: The following formula is used to implement bucket point aggregation for the j-th sub-computation task: Among them, G j is the jth sub-computation task, B l Represents the lth bucket point, where l is an integer.
6. A multi-scalar multiplication device, characterized in that: The device is used to accelerate the operation process of the multi-scalar multiplication on a central processing unit (CPU) platform, and the device comprises: A splitting module, used for splitting the original operation task of large-scale elliptic curve multi-scalar multiplication into multiple sub-operation tasks, each of which includes multiple point multiplication operations, each of which includes a sub-scalar and an elliptic curve point, and the elliptic curve point in each point multiplication operation corresponds to the sub-scalar; A first bucket filling module is configured to fill the plurality of elliptic curve points into a plurality of bucket points based on the subscalars corresponding to the plurality of elliptic curve points, wherein, in the case where there are two elliptic curve points that both need to be filled into the first bucket point, the two elliptic curve points are added to a primary storage sequence as a point to be added, and the first bucket point is any one of the plurality of bucket points; A point addition operation module, used for executing the N point addition operations to be performed in parallel based on SIMD instructions to obtain N first point addition results when there are N point addition operations to be performed in the primary storage sequence; A second bucket filling module, used for writing the N first point addition results back to the corresponding bucket points; A bucket point aggregation module, used for performing bucket point aggregation after all elliptic curve points in multiple point multiplication operations of any of the sub-operation tasks are filled into bucket points; The computing module is used to obtain the computing result of the original computing task based on the result of the bucket point aggregation of each of the sub-computing tasks.
7. The device according to claim 6, characterized in that The second bucket filling module is further used for adding the second point addition result and the point addition operation of the second bucket point as a pending point addition operation to the secondary storage sequence, wherein the second point addition result is any one of the N first point addition results, and the second bucket point is the bucket point corresponding to the second point addition result; When there are at least N pending point addition operations in the secondary storage sequence, the first N pending point addition operations in the secondary storage sequence are executed in parallel based on SIMD instructions to obtain N third point addition results; Based on the N third point addition results, the values of the corresponding bucket points are updated to achieve writing the N first point addition results back to the corresponding bucket points.
8. A computer device, characterized in that: The computer device comprises: a memory and a processor, wherein at least one computer program is stored in the memory, and the at least one computer program is loaded and executed by the processor to implement the method according to any one of claims 1 to 5.
9. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores at least one computer program, and the at least one computer program is loaded and executed by a processor to implement the method according to any one of claims 1 to 5.
10. A computer program product comprising a computer program / instructions, characterized in that When the computer program / instructions are executed by a processor, the method according to any one of claims 1 to 5 is implemented.
Citation Information
Patent Citations
Method and system for parallel processing of elliptic curve scalar multiplication
CN102446088A
Vector operation device and operation method
CN111580866A
Sm2 performance optimization implementation method
CN112134704A
CUDA (Compute Unified Device Architecture)-based elliptic curve multi-scalar multiplication acceleration method and system and storage medium
CN118295628A
CUDA (Compute Unified Device Architecture)-based elliptic curve multi-scalar multiplication acceleration method and system and storage medium
CN118312135A
Cited By
Multi-scalar multiplication optimization method and device, computer equipment and medium
CN120469718A
