Method and apparatus for optimizing multi-scalar multiplication operation, computer device and medium
Patent Information
- Application Number
- CN202510384789.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2025-03-28
- Publication Date
- 2026-09-15
- Estimated Expiration
- 2045-03-28
AI Technical Summary
目前多标量乘法运算中采用进入缓冲区后置处理的方案需要的缓冲区深度最大数量是点加法器延迟的级数,且数据先经过缓冲区再进入桶模块,无法避免不必要的存储操作,导致缓冲区资源消耗较大
[0020] This application discloses an optimization method, apparatus, computer device, and medium for multi-scalar multiplication operations. The method involves receiving scalars and elliptic curve points transmitted by the first-in-first-out queue and the elliptic curve point adder, respectively, based on the arbitrator, and determining whether the target buckets accessed by the two elliptic curve points are the same. If the target buckets accessed by the two elliptic curve points are different, the scalars are analyzed based on the bucket status register table to determine the number of times each elliptic curve point accesses the target bucket, and the read/write status of the two target buckets is updated based on the number of accesses. When the bucket module receives the scalars and elliptic curve points, it controls the scalars and elliptic curve points to access the target buckets according to the read/write status and the number of accesses, and then... When the read and write states are the same, the buffer is activated, and the buffer stores addition requests generated based on two sets of scalars and elliptic curve points. The multiplexer determines the request to be processed from the received addition requests and transmits the target request to the elliptic curve point adder. The elliptic curve point adder processes the request to be processed according to a preset three-coordinate calculation formula to obtain new scalars and elliptic curve points, and transmits the new scalars and elliptic curve points to the arbitrator for the next round of loop processing with the scalars and elliptic curve points in the first-in-first-out queue. When the first-in-first-out queue is empty, the loop processing ends, and bucket aggregation and group aggregation are performed based on the bucket status register table to obtain the calculation result. This application optimizes multi-scalar multiplication operations by maintaining the read and write states of the target buckets accessed by the two elliptic curve points and activating the buffer only when the read and write states of the two target buckets are the same, based on the activation and idle states of the control buffer. Furthermore, the elliptic curve point adder uses a scheme based on three-coordinate calculation formulas, thus reducing buffer storage operations and coordinate storage space, thereby reducing buffer depth and resource consumption.
Smart Images

Figure CN120469718B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of cryptography, and in particular to an optimized method, apparatus, computer device, and medium for multiscalar multiplication operations. Background Technology
[0002] In the computation of zero-knowledge proofs, MSM (Multi-Scalar Multiplication) is a crucial operation. MSM involves multiplication of multiple scalars and elliptic curve points, and is a core step in implementing multi-computation in zero-knowledge proof protocols. Currently, the scheme of post-processing in a buffer for MSM operations requires a buffer depth that is at most the order of the point adder's latency. Furthermore, data passes through the buffer before entering the bucket module, making unnecessary storage operations unavoidable and resulting in significant buffer resource consumption. Therefore, optimizing the MSM process and reducing resource consumption has become an urgent problem to solve. Summary of the Invention
[0003] This application provides an optimization method, apparatus, computer device, and medium for multi-scalar multiplication operations, so as to optimize the multi-scalar multiplication operation process and reduce resource consumption.
[0004] In a first aspect, this application provides an optimization method for multi-scalar multiplication operations. The optimization method is applied to a multi-scalar multiplication system, which includes a first-in-first-out queue, an arbitrator, a bucket status register table, a bucket module, a buffer, a multiplexer, and an elliptic curve point adder. The bucket module contains at least one bucket. The optimization method includes:
[0005] The arbiter receives scalars and elliptic curve points transmitted by the first-in-first-out queue and the elliptic curve point adder, respectively, and determines whether the target buckets accessed by the two elliptic curve points are the same.
[0006] When the target buckets accessed by the two elliptic curve points are different, the scalar is analyzed based on the bucket status register table to determine the number of times the two elliptic curve points access the target bucket, and the read / write status of the two target buckets is updated based on the number of accesses.
[0007] When the bucket module receives scalar and elliptic curve points, it controls the scalar and elliptic curve points to access the target bucket according to the read / write status and the number of accesses. When the read / write status of the two target buckets is the same, the buffer is activated and the addition request generated based on the two sets of scalar and elliptic curve points is stored in the buffer.
[0008] Based on the multiplexer, the request to be processed is determined from the received addition requests, and the target request is transmitted to the elliptic curve point adder;
[0009] The elliptic curve point adder processes the request to be processed according to the preset three-coordinate operation formula to obtain new scalars and elliptic curve points, and transmits the new scalars and elliptic curve points to the arbitrator for the next round of loop processing with the scalars and elliptic curve points in the first-in-first-out queue.
[0010] When the first-in-first-out queue is empty, the loop processing ends, and bucket aggregation and group aggregation are performed based on the bucket status register table to obtain the calculation results.
[0011] Secondly, this application also provides an optimization apparatus for multi-scalar multiplication operations, the apparatus comprising:
[0012] The target bucket determination module is used to determine whether the target buckets accessed by the two elliptic curve points are the same, based on the arbitrator receiving the scalar and elliptic curve points transmitted by the first-in-first-out queue and the elliptic curve point adder, respectively.
[0013] The read / write status update module is used to analyze the scalar based on the bucket status register table when the target buckets accessed by the two elliptic curve points are different, to determine the number of times the two elliptic curve points access the target buckets, and to update the read / write status of the two target buckets based on the number of accesses respectively.
[0014] An addition request generation module is used to control the scalar and elliptic curve points to access the target bucket according to the read / write status and the number of accesses when the bucket module receives scalar and elliptic curve points, and to activate the buffer when the read / write status of the two target buckets is the same, and to store the addition requests generated based on the two sets of scalar and elliptic curve points in the buffer.
[0015] The pending request determination module is used to determine the pending request from the received addition requests based on the multiplexer, and transmit the target request to the elliptic curve point adder;
[0016] The addition request processing module is used to process the request to be processed according to the preset three-coordinate operation formula based on the elliptic curve point adder to obtain new scalar and elliptic curve points, and transmit the new scalar and elliptic curve points to the arbitrator for the next round of loop processing with the scalar and elliptic curve points in the first-in-first-out queue.
[0017] The calculation result acquisition module is used to end the loop processing when the first-in-first-out queue is empty, and perform bucket aggregation and group aggregation processing based on the bucket status register table to obtain the calculation result.
[0018] Thirdly, this application also provides a computer device, the computer device including a memory and a processor; the memory is used to store a computer program; the processor is used to execute the computer program and, when executing the computer program, implement the optimization method for multi-scalar multiplication operations as described above.
[0019] Fourthly, this application also provides a computer-readable storage medium storing a computer program that, when executed by a processor, causes the processor to implement the optimized method for multi-scalar multiplication operations as described above.
[0020] This application discloses an optimization method, apparatus, computer device, and medium for multi-scalar multiplication operations. The method involves receiving scalars and elliptic curve points transmitted by the first-in-first-out queue and the elliptic curve point adder, respectively, based on the arbitrator, and determining whether the target buckets accessed by the two elliptic curve points are the same. If the target buckets accessed by the two elliptic curve points are different, the scalars are analyzed based on the bucket status register table to determine the number of times each elliptic curve point accesses the target bucket, and the read / write status of the two target buckets is updated based on the number of accesses. When the bucket module receives the scalars and elliptic curve points, it controls the scalars and elliptic curve points to access the target buckets according to the read / write status and the number of accesses, and then... When the read and write states are the same, the buffer is activated, and the buffer stores addition requests generated based on two sets of scalars and elliptic curve points. The multiplexer determines the request to be processed from the received addition requests and transmits the target request to the elliptic curve point adder. The elliptic curve point adder processes the request to be processed according to a preset three-coordinate calculation formula to obtain new scalars and elliptic curve points, and transmits the new scalars and elliptic curve points to the arbitrator for the next round of loop processing with the scalars and elliptic curve points in the first-in-first-out queue. When the first-in-first-out queue is empty, the loop processing ends, and bucket aggregation and group aggregation are performed based on the bucket status register table to obtain the calculation result. This application optimizes multi-scalar multiplication operations by maintaining the read and write states of the target buckets accessed by the two elliptic curve points and activating the buffer only when the read and write states of the two target buckets are the same, based on the activation and idle states of the control buffer. Furthermore, the elliptic curve point adder uses a scheme based on three-coordinate calculation formulas, thus reducing buffer storage operations and coordinate storage space, thereby reducing buffer depth and resource consumption. Attached Figure Description
[0021] To more clearly illustrate the technical solutions of the embodiments of this application, the drawings used in the description of the embodiments will be briefly introduced below. Obviously, the drawings described below are some embodiments of this application. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0022] Figure 1 This is a schematic diagram of the framework of a multi-scalar multiplication operation system provided in an embodiment of this application;
[0023] Figure 2 This is a schematic flowchart of an optimization method for multi-scalar multiplication provided in the first embodiment of this application;
[0024] Figure 3 This is a schematic flowchart of an optimization method for multi-scalar multiplication provided in the second embodiment of this application;
[0025] Figure 4 This is a schematic diagram of the Pippenger algorithm calculation process provided in an embodiment of this application;
[0026] Figure 5 A schematic block diagram of an optimization device for multiscalar multiplication provided for embodiments of this application;
[0027] Figure 6 A schematic block diagram of the structure of a computer device provided for an embodiment of this application. Detailed Implementation
[0028] The technical solutions of the embodiments of this application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of this application, not all embodiments. Based on the embodiments of this application, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of this application.
[0029] The flowchart shown in the attached diagram is for illustrative purposes only and does not necessarily include all content and operations / steps, nor does it necessarily have to be performed in the order described. For example, some operations / steps can be broken down, combined, or partially merged, so the actual execution order may change depending on the actual situation.
[0030] It should be understood that the terminology used in this specification is for the purpose of describing particular embodiments only and is not intended to limit the scope of the application. As used in this specification and the appended claims, the singular forms “a,” “an,” and “the” are intended to include the plural forms unless the context clearly indicates otherwise.
[0031] It should also be understood that the term "and / or" as used in this application specification and the appended claims means any combination of one or more of the associated listed items and all possible combinations, and includes such combinations.
[0032] This application provides an optimization method, apparatus, computer device, and medium for multi-scalar multiplication operations. The optimization method can be applied to multi-scalar multiplication systems and servers. By maintaining the read / write status of the target buckets accessed by two elliptic curve points, and activating the buffer only when the read / write status of the two target buckets is the same, based on the activation and idle status of the control buffer, and employing a scheme based on a three-coordinate calculation formula in the elliptic curve point adder, the optimization of multi-scalar multiplication operations is achieved, reducing buffer storage operations and coordinate storage space, thereby reducing buffer depth and resource consumption. The server can be a standalone server or a server cluster.
[0033] The following detailed description of some embodiments of this application is provided in conjunction with the accompanying drawings. Unless otherwise specified, the following embodiments and features can be combined with each other.
[0034] Please see Figure 1 , Figure 1 This is a schematic diagram of the framework of a multi-scalar multiplication system provided by an embodiment of this application. The multi-scalar multiplication system is used to perform an optimized method for multi-scalar multiplication operations.
[0035] like Figure 1 As shown, the multiscalar multiplication system includes a first-in-first-out queue, an arbiter, a bucket status register table, a bucket module, a buffer, a multiplexer, and a three-axis elliptic curve point adder.
[0036] In one embodiment, a first-in, first-out (FIFO) queue is used to store input scalars and points into the queue space. This queue space not only stores the scalar and coordinates of a single point but also expands the scalar to a multiple of 8 closest to its bit width. Once a point is written, the write operation stops, and the scalar and point data are read out according to the bit width of "scalar / / 8+1". When only one data item remains in the queue, both read and write operations are performed simultaneously to maximize the queue's ability to process point data. Here, "scalar / / 8+1" means dividing the scalar's bit width by 8 and rounding down to obtain a size in bytes, then adding 1 to ensure that the read bit width covers the entire scalar data.
[0037] The arbitrator handles points and scalars from the FIFO queue and the elliptic curve point adder. It determines whether two points access different buckets; if so, it skips the step of accessing the bucket status register table and directly outputs both points to the multiplexer for the highest priority addition operation; otherwise, it sends them together to the bucket status register table for further processing.
[0038] The bucket status register table receives input scalars, analyzes them to determine the number of times the target bucket's corresponding position is accessed, and outputs and updates the accessed status of the target bucket. The status is either 0 or 1, which determines the read / write enable / disable of the bucket module.
[0039] The bucket module comprises multiple buckets, which are multidimensional arrays of multiple random access memory (RAM) blocks used to store the corresponding points currently stored for each scalar. It receives newly arriving points and the read / write status of the target bucket when that point accesses it, determining whether to write the new point into the target bucket or output it along with existing points to the multiplexer for further processing. Furthermore, each bucket internally maintains three pointers and three status registers. Changes in the status registers determine changes in the pointers, thereby enabling the reading and writing of specific internal data in the RAM, completing the three stages of the MSM operation.
[0040] The buffer is a double-read, zero-read-triggered buffer, a space used to store pending addition requests. Each addition request contains two points and a corresponding scalar. The double-read, zero-read-triggered buffer is only activated when both points accessed by the bucket module are simultaneously read-enabled, or neither is read-enabled (including the case where neither is enabled). Other read / write states, such as single-read, single-write, will leave this buffer idle and perform no operations.
[0041] The multiplexer is a three-to-one module used to filter addition operations from three different sources, ensuring that only one addition operation can be input into the elliptic curve point adder for calculation at any given time.
[0042] The elliptic curve adder employs a three-coordinate scheme, taking the coordinates of two points as input and outputting the calculated new coordinates. A single elliptic curve adder can perform atomic operations including point addition and doubling. When the two input points are the same, a doubling operation is performed; otherwise, addition of the two points on the elliptic curve is performed. The adder's submodules include modules for large number modular multiplication, large number modular addition, and large number modular subtraction. The large number modular multiplication submodule uses the karatsuba module, while the large number modular addition and large number modular subtraction modules use single modules with configurable addition and subtraction functions.
[0043] Please see Figure 2 , Figure 2This is a schematic flowchart illustrating an optimization method for multi-scalar multiplication provided in an embodiment of this application.
[0044] like Figure 2 As shown, the optimization method for multi-scalar multiplication specifically includes steps S101 to S105.
[0045] S101. Based on the arbiter, receive the scalar and elliptic curve points transmitted by the first-in-first-out queue and the elliptic curve point adder respectively, and determine whether the target buckets accessed by the two elliptic curve points are the same.
[0046] In one embodiment, the first-in-first-out queue reads scalar and elliptic curve points according to a preset reading rule and transmits them to the arbitrator.
[0047] The scalar and elliptic curve points transmitted by the elliptic curve point adder to the arbitrator are the new scalar and elliptic curve points obtained in the previous round. The current round of processing is performed based on the new scalar and elliptic curve points obtained in the previous round and the scalar and elliptic curve points in the first-in-first-out queue.
[0048] When the arbitrator receives a point and a scalar from the first-in-first-out queue and the elliptic curve point adder, it determines the target bucket that the elliptic curve point needs to access based on the scalar and judges whether the target buckets accessed by the two points are the same.
[0049] Specifically, scalars are converted to binary form for bitwise operations and block processing. Based on a preset window size (e.g., 4 bits, 8 bits), the binary representation of the scalar is divided into multiple blocks. The value of each block determines the bucket a point belongs to; for example, a value of 18 corresponds to bucket 18. For two scalars, the corresponding bucket number is calculated based on the value or size range of the binary blocks. The bucket numbers of the two scalars are compared. If the bucket numbers are the same, the target buckets are considered the same; otherwise, the target buckets are considered different.
[0050] Furthermore, before the step of receiving the scalar and elliptic curve points transmitted by the first-in-first-out queue and the elliptic curve point adder based on the arbiter, and determining whether the target buckets accessed by the two elliptic curve points are the same, the method further includes: receiving the scalar and elliptic curve points input by the user based on the first-in-first-out queue, and performing bit-width alignment operation on the scalar; and reading the scalar and elliptic curve points to the arbiter according to a preset reading rule.
[0051] In one embodiment, the First-In-First-Out (FIFO) queue stores input scalars and points into its space. This queue not only stores the scalar and coordinates of a single point but also expands the scalar to a multiple of 8 closest to its bit width. Once a point is written, the write operation stops, and the scalar and point data are read according to a preset read rule. When only one data item remains in the queue, both read and write operations are performed simultaneously, maximizing the queue's ability to process point data.
[0052] The reading rule is to read scalar and dot data according to the bit width of "scalar / / 8+1", where "scalar / / 8+1" means dividing the scalar's bit width by 8, rounding down, and adding 1. For example, if the scalar's bit width is 16 bits, then 16 / / 8 = 2, and the read bit width is 2 + 1 = 3 bytes. If the scalar's bit width is 24 bits, then 24 / / 8 = 3, and the read bit width is 3 + 1 = 4 bytes.
[0053] Specifically, a scalar is an integer, and elliptic curve points are represented by three coordinates, such as (X, Y, Z). To improve data processing efficiency and compatibility, the FIFO (First-In, First-Out) queue module expands the bit width of a scalar to a multiple of 8 nearest to its current bit width. For example, if the scalar's bit width is 10 bits, it will be expanded to 16 bits. This ensures that data can be processed efficiently during storage and transmission.
[0054] In one embodiment, the read scalar and point are transmitted to the arbitrator for further processing.
[0055] S102. When the target buckets accessed by the two elliptic curve points are different, the scalar is analyzed based on the bucket status register table to determine the number of times the two elliptic curve points access the target buckets, and the read / write status of the two target buckets is updated based on the number of accesses.
[0056] In one embodiment, when the target buckets visited by two elliptic curve points are different, the two scalars and the elliptic curve points are sent to the bucket status register table.
[0057] When the bucket status register table receives an input scalar, it analyzes the scalar to determine the number of times the two elliptic curve points access the target bucket. For example, if scalar 1 and elliptic curve point 1 access the first target bucket, and scalar 2 and elliptic curve point 2 access the second target bucket, and the window value 18 appears once in the window list of scalar 1, it indicates that the first target bucket 18 was accessed once; if the window value 18 appears twice in the window list of scalar 2, it indicates that the second target bucket 18 was accessed twice.
[0058] The read / write state is divided into 1 (read enabled) and 0 (write enabled), and these two states determine the read and write enable of the bucket module.
[0059] Furthermore, after the arbiter receives the scalar and elliptic curve points transmitted by the first-in-first-out queue and the elliptic curve point adder respectively, and determines whether the target buckets accessed by the two elliptic curve points are the same, the method further includes: when the target buckets accessed by the two elliptic curve points are the same, generating an addition request based on the arbiter and the two sets of scalar and elliptic curve points, and distributing the addition request to the multiplexer.
[0060] In one embodiment, when two elliptic curve points access the same target bucket, the step of accessing the bucket status register table is skipped, the arbitrator generates an addition request based on the two sets of scalars and elliptic curve points, and distributes the addition request to the multiplexer.
[0061] S103. When the bucket module receives scalar and elliptic curve points, it controls the scalar and elliptic curve points to access the target bucket according to the read / write status and the number of accesses. When the read / write status of the two target buckets is the same, it activates the buffer and stores the addition request generated based on the two sets of scalar and elliptic curve points in the buffer.
[0062] In one embodiment, the bucket module includes multiple buckets to store the corresponding points currently stored for each scalar. Upon receiving a new point, based on its read / write status, it determines whether to write the new point into the bucket or output it along with existing points in the bucket to a multiplexer for further processing. For example, when the read / write status of the target bucket is 0, the currently accessed elliptic curve point is written into the target bucket. At this time, the target bucket's status is updated to 1. When the next elliptic curve point accesses the target bucket, it reads both the elliptic curve points in the bucket and the currently accessed elliptic curve point based on status 1.
[0063] In one embodiment, when the read and write states are the same, a buffer is activated to store addition requests generated based on two sets of scalars and elliptic curve points. Specifically, the buffer is activated only when both read and write states are enabled (read enabled) or neither is enabled (including the case where it is not enabled). Other states (such as single read / single write) leave the buffer idle, without any operation. For example, suppose elliptic curve point 1 accesses the first target bucket and elliptic curve point 2 accesses the second target bucket. The read and write states of the first target bucket could be 0 and 1, and the read and write states of the second target bucket could also be 0 and 1. Therefore, the states of the first and second target buckets could be 00, 01, 10, and 11, where 00 and 11 indicate that the read and write states of the two target buckets are the same, and 01 and 10 indicate that the read and write states of the two target buckets are different.
[0064] Furthermore, after the step of determining the number of accesses to the target bucket by the two elliptic curve points based on the scalar when the bucket status register table receives the scalar and elliptic curve points, and updating the read / write status of the two target buckets based on the number of accesses, the step further includes: when the read / write status of the target buckets are different, generating an addition request based on the bucket module and the two sets of scalar and elliptic curve points, and transmitting the addition request to the multiplexer.
[0065] In one embodiment, when the read and write states are different (such as single read and single write), the buffer will be idle and no operation will be performed. The bucket module directly generates an addition request based on the two sets of scalars and elliptic curve points, and transmits the addition request to the multiplexer.
[0066] S104. Based on the multiplexer, determine the request to be processed from the received addition requests, and transmit the target request to the elliptic curve point adder;
[0067] In one embodiment, the multiplexer is a three-way selector module used to filter addition requests from the arbitrator, bucket module, and buffer, ensuring that only one addition request can be input into the elliptic curve point adder for operation at any given time.
[0068] Understandably, a multiplexer will only receive one addition request at a time. If the addition request is found to be valid, it will be designated as a request to be processed.
[0069] S105. Based on the elliptic curve point adder, the request to be processed is processed according to the preset three-coordinate operation formula to obtain new scalar and elliptic curve points, and the new scalar and elliptic curve points are transmitted to the arbitrator to perform the next round of loop processing with the scalar and elliptic curve points in the first-in-first-out queue.
[0070] In one embodiment, an elliptic curve adder calculates new output coordinates and their corresponding scalars based on the coordinates of two input points. A single elliptic curve adder can perform atomic operations including point addition and doubling. When the two input points are the same, a doubling operation is performed; otherwise, addition of the two points on the elliptic curve is performed.
[0071] In one embodiment, the newly obtained scalar and elliptic curve points are transmitted to the arbitrator, and then processed in the next round of the loop along with the scalar and elliptic curve points transmitted to the arbitrator from the first-in-first-out queue.
[0072] S106. When the first-in-first-out queue is empty, the loop processing ends, and bucket aggregation and group aggregation processing are performed based on the bucket status register table to obtain the calculation result.
[0073] In one embodiment, when the first-in-first-out queue is empty, all points of the scalar have been processed, the loop ends, the status register in the bucket module changes, and the bucket aggregation phase and group aggregation phase begin.
[0074] Specifically, bucket aggregation processing includes traversing all non-empty buckets in index order or in parallel, reading all points in the current bucket, and performing an accumulation operation on all points in each bucket to obtain the accumulated result. Group aggregation processing includes weighted combining the accumulated results of each bucket according to the bucket weights to obtain the final multi-scalar multiplication result.
[0075] The above embodiments maintain the read / write status of the target buckets accessed by the two elliptic curve points, and activate the buffer only when the read / write status of the two target buckets is the same, based on the activation and idle status of the control buffer. Furthermore, the elliptic curve point adder adopts a scheme based on the three-coordinate operation formula, thereby optimizing the multi-scalar multiplication operation, reducing the buffer storage operations and coordinate storage space, and thus reducing the buffer depth and resource consumption.
[0076] Please see Figure 3 , Figure 3 This is a schematic flowchart illustrating an optimization method for multi-scalar multiplication provided in an embodiment of this application.
[0077] like Figure 3 As shown, the optimization method for multi-scalar multiplication specifically includes steps S201 to S202.
[0078] S201. Analyze the request to be processed based on the elliptic curve point adder, and obtain the point coordinates of the two elliptic curve points respectively, wherein the point coordinates are represented by a three-coordinate system.
[0079] S202. Based on the large number modular multiplication module, large number modular addition module, and large number modular subtraction module in the elliptic curve point adder, perform point operations on the three-coordinate operation formula and the coordinates of the two points to obtain new elliptic curve points.
[0080] Furthermore, the three-coordinate calculation formula is as follows:
[0081] X3=(X1Y2+X2Y1)(Y1Y2-3Z1Z2)-3(Y1Z2+Y2Z1)(X1Z2+X2Z1)
[0082] Y3=(Y1Y2+3Z1Z2)(Y1Y2-3Z1Z2)-9X1X2(X1Z2+X2Z2)
[0083] Z3=(Y1Z2+Y2Z1)(Y1Y2+3Z1Z2)+3X1X2(X1Y2+X2Y1)
[0084] (X1, Y1, Z1) are the coordinates of the first elliptic curve point, (X2, Y2, Z2) are the coordinates of the second elliptic curve point, and (X3, Y3, Z3) are the coordinates of the new elliptic curve point.
[0085] In one embodiment, multi-scalar multiplication needs to accomplish the following task:
[0086]
[0087] Here, K and P are both vectors with a length of 2. N ,i represents the dot product of the i-th vector. Depending on the choice of the elliptic curve, each of the K vectors... i Both are large number scalars with more than two hundred digits. A vector P is a two-dimensional vector with P... x and P y Both have a bit width of over 300 bits. Q is the final calculated result, also a point vector, the same as P. Elliptic curve addition is not the constant addition of the general case, but point addition based on elliptic curve cryptography. Point addition means that when two points on an elliptic curve intersect, the intersection point of their extensions with the elliptic curve is the point of addition. The general formula for an elliptic curve is:
[0088] y 2 =x 3 +ax+b
[0089] Here, a and b are constants within a finite field. For example, when a = 0 and b = 1, the elliptic curve is BLS12-377; when a = 0 and b = 4, the elliptic curve is BLS12-381. This patent uses the BLS12-377 algorithm as an example, employing a three-coordinate scheme for elliptic curve point addition. In the elliptic curve affine coordinate system, point addition and point doubling operations require division. However, division is a very inefficient and time-consuming operation for computer hardware. In the three-coordinate scheme, division can be replaced by multiplication and addition, reducing the number of multiplication and addition operations and improving computational efficiency. The specific formula is as follows:
[0090] X3=(X1Y2+X2Y1)(Y1Y2-3Z1Z2)-3(Y1Z2+Y2Z1)(X1Z2+X2Z1)
[0091] Y3=(Y1Y2+3Z1Z2)(Y1Y2-3Z1Z2)-9X1X2(X1Z2+X2Z2)
[0092] Z3=(Y1Z2+Y2Z1)(Y1Y2+3Z1Z2)+3X1X2(X1Y2+X2Y1)
[0093] In one embodiment, the Pippenger algorithm is used to improve the computational efficiency of MSM. The Pippenger algorithm significantly reduces the computational complexity of MSM by decreasing the number of scalar multiplications and optimizing the computation order, thereby accelerating the entire computation process.
[0094] Generally, all K will be... i and P i The algorithm first multiplies the components separately and then adds them together; its computational complexity is O(n). 2 However, according to the Pippenger algorithm, the computational complexity can be reduced to nlog₂n. Specifically, such as... Figure 4 As shown, by using a large number K i Divide into smaller Gs j Each G j There is b position ( Figure 4 (where b = 4), b*j / i mod b <b。
[0095] Therefore, each G j There are 2b possibilities, and each scalar that is split must satisfy G. j ≤2b, the total number of buckets is 2b*j, and the size of a single bucket is the bit width of the coordinate * 3. When a point visits a bucket, it enters the corresponding bucket based on the scalar value of that bucket. Thus, a single point is split into j points. After all points have entered the buckets, the points in each bucket are already the calculated results. We only need to double the weights of the buckets back to their initial weights and then sum them. This eliminates the need for large scalar multiplication operations, transforming them into numerous point addition operations, thus reducing the design complexity.
[0096] In each G j There are 2b points. We can reduce one loop by using a circular register of intermediate states. For example, when calculating B... 15 +B 14 At that time, B can be calculated simultaneously in the next stage. 15 +B 14 +B 13 and 2B 15 +B 14 In the next stage, we can use B 15 +B 14 +B 13 This is an intermediate state that drives the next two additions simultaneously, so that the double-loop addition can be calculated in just one loop.
[0097] During the aggregation phase, each G j It needs to multiply itself by b*j times, and then add all the Gs. j Add them together to get the final result.
[0098] Specifically, the coordinates of two elliptic curve points are obtained from the pending request. These coordinates are represented in a three-coordinate system. Substituting these coordinates into the three-coordinate calculation formula yields the formula to be calculated. The formula is then calculated using the large number modular multiplication, large number modular addition, and large number modular subtraction modules to obtain new coordinates. The scalar corresponding to the new elliptic curve point is the sum of the window values after decomposing the original two scalars.
[0099] To reduce redundant calculations and improve computational efficiency, current elliptic curve point addition operations often employ a four-coordinate scheme. This means using four coordinate values to represent the coordinates of an elliptic curve point. For example, in extended Jacobian coordinates, the coordinates of an elliptic curve point can be represented as (X, Y, Z, T), where T = aZ. 4 (a is an elliptic curve parameter), and (X, Y, Z) are consistent with traditional Jacobian coordinates, used to represent the position of a point. T is used to cache intermediate values related to curve parameters a and Z to avoid redundant calculations. However, the four-coordinate scheme results in a very high bit width for a single read / write operation, leading to high power consumption and resource consumption. Therefore, this application's embodiment uses a three-coordinate scheme and different mathematical formulas to calculate point addition, which avoids redundant calculations and reduces the register space required for a unit operation and the input / output bit width of the point adder module, achieving quantifiable effects such as a 25% reduction in register space and a 30% reduction in bit width.
[0100] Furthermore, the step of performing point operations on the three-coordinate calculation formula and the coordinates of the two points based on the large number modular multiplication module, large number modular addition module, and large number modular subtraction module in the elliptic curve point adder to obtain a new elliptic curve point includes: generating a calculation task based on the three-coordinate calculation formula and the point coordinates; splitting the calculation task based on the calculation attributes to obtain at least one calculation subtask; and performing parallel calculations on the calculation subtask based on the large number modular multiplication module, the large number modular addition module, and the large number modular subtraction module to obtain the new elliptic curve point.
[0101] In one embodiment, specific computation tasks are generated based on the three-coordinate calculation formula and point coordinates. Each computation task includes operations such as scalar multiplication and point addition.
[0102] Based on the operational attributes (such as multiplication, point addition, point doubling, etc.) and the characteristics of the data (such as point coordinates, scalar size, etc.), the computational tasks are classified and broken down.
[0103] Splitting strategies can include splitting by scalar size: breaking down a large scalar multiplication task into multiple smaller scalar multiplication tasks. For example, calculating a × P can be split into multiple point additions and point doubling operations; splitting by point grouping: grouping multiple point scalar multiplication tasks, with points within each group being processed in parallel; and splitting by operation type: processing scalar multiplication and point addition separately to optimize different types of operations.
[0104] In one embodiment, the large number modular multiplication module is responsible for performing large number modular multiplication operations, which are typically used for doubling operations in scalar multiplication; the large number modular addition module and the large number modular subtraction module are responsible for performing large number modular addition and modular subtraction operations. The large number modular multiplication submodule uses a karatsuba module, while the large number modular addition and large number modular subtraction modules use a single module with configurable addition and subtraction functions.
[0105] In one embodiment, the large number modular multiplication module is implemented using the Barrett algorithm. The Barrett algorithm is an efficient algorithm for calculating large number modular multiplication (i.e., calculating a*b mod n). It improves the efficiency of modular operations by pre-computing and reducing division operations, making it particularly suitable for large number operations. By pre-computing a constant μ, the division operations in modular operations are transformed into multiplication and bit shifting operations, thereby improving computational efficiency. The specific steps are as follows:
[0106] 1. Select
[0107] 2. Calculate t←(a﹒m)>>k
[0108] 3. Calculate a←at﹒ q
[0109] 4. if a≥q
[0110] 5. a←aq
[0111] 6. return a
[0112] Among them, symbols Indicates rounding up, sign This indicates rounding down to the nearest integer.
[0113] In one embodiment, the submodule (karatsuba module) of the large number modular multiplication module employs the Karatsuba algorithm, an efficient algorithm for large number multiplication. It reduces the number of multiplication operations through a divide-and-conquer approach, thereby improving computational efficiency. Specifically, a 384-bit constant multiplication is converted into three half-bit constant multiplications, iterated until the subunit is a 48-bit multiplication. The multiplications at different positions are then processed in parallel and finally merged into the final result.
[0114] For example, when calculating a large number X*Y, X*Y can be transformed into AB*CD, where AB and CD are the two parts of X and Y with equal numbers of digits at the beginning and end. Following the general approach, AB*CD = AC + (AD + BC) + BD. If we transform the intermediate (AD + BC) into (A + B)*(C + D) - AC – BD, we can utilize the already calculated values of AC and BD as intermediate states, avoiding redundant calculations. Compared to the general approach of two multiplications and one addition, the Karatsuba algorithm only needs to perform one multiplication with a bit width half that of X and Y to calculate the intermediate state result.
[0115] In one embodiment, computational efficiency can be significantly improved by distributing computational subtasks to different modules for parallel computation. For example, multiple subtasks can be executed simultaneously on different large number modular multiplication, large number modular addition, and large number modular subtraction modules.
[0116] In the above embodiments, the use of a three-coordinate scheme reduces the register resources occupied when storing coordinate information, resulting in a significant reduction in the required register space. The three-coordinate scheme reduces register space by approximately 24%, thus lowering resource consumption. Secondly, by integrating the large number operation modules (including large number modular multiplication, large number modular addition, and large number modular subtraction modules) into the elliptic curve point adder, coarse-grained fully pipelined calculation of points can be achieved, allowing multiple calculation steps to be executed in parallel, accelerating the overall calculation process and significantly improving computational efficiency.
[0117] Please see Figure 5 , Figure 5 This is a schematic block diagram of an optimization apparatus for multi-scalar multiplication operations, provided by an embodiment of this application. This optimization apparatus is used to execute the aforementioned optimization method for multi-scalar multiplication operations. The optimization apparatus can be configured on a server.
[0118] like Figure 5 As shown, the optimization device 300 for multi-scalar multiplication includes:
[0119] The target bucket determination module 301 is used to receive the scalar and elliptic curve points transmitted by the first-in-first-out queue and the elliptic curve point adder respectively based on the arbiter, and determine whether the target buckets accessed by the two elliptic curve points are the same.
[0120] The read / write status update module 302 is used to analyze the scalar based on the bucket status register table when the target buckets accessed by the two elliptic curve points are different, to determine the number of times the two elliptic curve points access the target buckets, and to update the read / write status of the two target buckets based on the number of accesses respectively.
[0121] The addition request generation module 303 is used to control the scalar and elliptic curve points to access the target bucket according to the read / write status and the number of accesses when the bucket module receives the scalar and elliptic curve points, and to activate the buffer when the read / write status of the two target buckets is the same, and to store the addition request generated based on the two sets of scalar and elliptic curve points in the buffer.
[0122] The pending request determination module 304 is used to determine the pending request from the received addition requests based on the multiplexer, and transmit the target request to the elliptic curve point adder.
[0123] The addition request processing module 305 is used to process the request to be processed according to the preset three-coordinate operation formula based on the elliptic curve point adder to obtain new scalar and elliptic curve points, and transmit the new scalar and elliptic curve points to the arbitrator for the next round of loop processing with the scalar and elliptic curve points in the first-in-first-out queue.
[0124] The calculation result acquisition module 306 is used to end the loop processing when the first-in-first-out queue is empty, and perform bucket aggregation and group aggregation processing based on the bucket status register table to obtain the calculation result.
[0125] Furthermore, the addition request processing module 305 includes:
[0126] The point coordinate acquisition unit is used to analyze the request to be processed based on the elliptic curve point adder and acquire the point coordinates of the two elliptic curve points respectively, wherein the point coordinates are represented by a three-coordinate system.
[0127] The point operation unit is used to perform point operations on the three-coordinate operation formula and the coordinates of the two points based on the large number modular multiplication module, large number modular addition module and large number modular subtraction module in the elliptic curve point adder, to obtain new elliptic curve points.
[0128] Furthermore, the point arithmetic unit includes:
[0129] The computation task generation subunit is used to generate computation tasks based on the three-coordinate computation formula and the point coordinates;
[0130] The computation task splitting subunit is used to split the computation task based on the computation attributes to obtain at least one computation subtask;
[0131] The parallel computing subunit is used to perform parallel computing on the operation subtask based on the large number modular multiplication module, the large number modular addition module, and the large number modular subtraction module to obtain the new elliptic curve point.
[0132] Furthermore, the three-coordinate calculation formula is as follows:
[0133] X3=(X1Y2+X2Y1)(Y1Y2-3Z1Z2)-3(Y1Z2+Y2Z1)(X1Z2+X2Z1)
[0134] Y3=(Y1Y2+3Z1Z2)(Y1Y2-3Z1Z2)-9X1X2(X1Z2+X2Z2)
[0135] Z3=(Y1Z2+Y2Z1)(Y1Y2+3Z1Z2)+3X1X2(X1Y2+X2Y1)
[0136] (X1, Y1, Z1) are the coordinates of the first elliptic curve point, (X2, Y2, Z2) are the coordinates of the second elliptic curve point, and (X3, Y3, Z3) are the coordinates of the new elliptic curve point.
[0137] Furthermore, the optimization device 300 for multi-scalar multiplication also includes an addition request generation module, which is used to generate an addition request based on the arbitrator and two sets of scalars and elliptic curve points when the target buckets accessed by the two elliptic curve points are the same, and to distribute the addition request to the multiplexer.
[0138] Furthermore, the optimization device 300 for multi-scalar multiplication also includes an addition request generation module, which is used to generate an addition request based on the bucket module and two sets of scalar and elliptic curve points when the read and write states of the target bucket are different, and to transmit the addition request to the multiplexer.
[0139] Furthermore, the optimization device 300 for multi-scalar multiplication operations also includes a data storage and retrieval module, which includes:
[0140] The data receiving unit is used to receive scalar and elliptic curve points input by the user based on the first-in-first-out queue, and to perform bit-width alignment operation on the scalar.
[0141] The data reading unit is used to read scalar and elliptic curve points into the arbiter according to preset reading rules.
[0142] It should be noted that those skilled in the art will understand that, for the sake of convenience and brevity, the specific working processes of the above-described apparatus and modules can be referred to the corresponding processes in the foregoing method embodiments, and will not be repeated here.
[0143] The aforementioned device can be implemented as a computer program, which can be used in, for example... Figure 6 It runs on the computer device shown.
[0144] Please see Figure 6 , Figure 6 This is a schematic block diagram illustrating the structure of a computer device according to an embodiment of this application. The computer device may be a server.
[0145] See Figure 6 The computer device includes a processor, memory, and network interface connected via a system bus, wherein the memory may include non-volatile storage media and internal memory.
[0146] Non-volatile storage media can store operating systems and computer programs. These computer programs include program instructions that, when executed, cause the processor to perform an optimized method for any multiscalar multiplication operation.
[0147] The processor provides computing and control capabilities, supporting the operation of the entire computer device.
[0148] Internal memory provides an environment for the execution of computer programs stored in non-volatile storage media. When these computer programs are executed by the processor, the processor can perform any optimized method for multiscalar multiplication operations.
[0149] This network interface is used for network communication, such as sending assigned tasks. Those skilled in the art will understand that... Figure 6 The structure shown is merely a block diagram of a portion of the structure related to the present application and does not constitute a limitation on the computer device to which the present application is applied. Specific computer devices may include more or fewer components than those shown in the figure, or combine certain components, or have different component arrangements.
[0150] It should be understood that the processor can be a Central Processing Unit (CPU), but it can also be other general-purpose processors, digital signal processors (DSPs), application-specific integrated circuits (ASICs), field-programmable gate arrays (FPGAs), or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. Among these, a general-purpose processor can be a microprocessor or any conventional processor.
[0151] In one embodiment, the processor is configured to run a computer program stored in memory to perform the following steps:
[0152] The arbiter receives scalars and elliptic curve points transmitted by the first-in-first-out queue and the elliptic curve point adder, respectively, and determines whether the target buckets accessed by the two elliptic curve points are the same.
[0153] When the target buckets accessed by the two elliptic curve points are different, the scalar is analyzed based on the bucket status register table to determine the number of times the two elliptic curve points access the target bucket, and the read / write status of the two target buckets is updated based on the number of accesses.
[0154] When the bucket module receives scalar and elliptic curve points, it controls the scalar and elliptic curve points to access the target bucket according to the read / write status and the number of accesses. When the read / write status of the two target buckets is the same, the buffer is activated and the addition request generated based on the two sets of scalar and elliptic curve points is stored in the buffer.
[0155] Based on the multiplexer, the request to be processed is determined from the received addition requests, and the target request is transmitted to the elliptic curve point adder;
[0156] The elliptic curve point adder processes the request to be processed according to the preset three-coordinate operation formula to obtain new scalars and elliptic curve points, and transmits the new scalars and elliptic curve points to the arbitrator for the next round of loop processing with the scalars and elliptic curve points in the first-in-first-out queue.
[0157] When the first-in-first-out queue is empty, the loop processing ends, and bucket aggregation and group aggregation are performed based on the bucket status register table to obtain the calculation results.
[0158] In one embodiment, when the processor processes the request to be processed based on the elliptic curve point adder according to a preset three-coordinate calculation formula to obtain new elliptic curve points, it is used to implement:
[0159] The request to be processed is analyzed based on the elliptic curve point adder, and the coordinates of the two elliptic curve points are obtained respectively, wherein the coordinates are represented by a three-coordinate system.
[0160] Based on the large number modular multiplication module, large number modular addition module, and large number modular subtraction module in the elliptic curve point adder, point operations are performed on the three-coordinate calculation formula and the coordinates of the two points to obtain new elliptic curve points.
[0161] In one embodiment, when the processor implements point operations on the three-coordinate calculation formula and the coordinates of the two points based on the large number modular multiplication module, large number modular addition module, and large number modular subtraction module in the elliptic curve point adder to obtain new elliptic curve points, it is used to:
[0162] Based on the three-coordinate calculation formula and the point coordinates, a calculation task is generated;
[0163] Based on the computational attributes, the computational task is split to obtain at least one computational subtask;
[0164] The large number modular multiplication module, the large number modular addition module, and the large number modular subtraction module are used to perform parallel calculations on the operation subtasks to obtain the new elliptic curve points.
[0165] In one embodiment, the three-coordinate calculation formula is:
[0166] X3=(X1Y2+X2Y1)(Y1Y2-3Z1Z2)-3(Y1Z2+Y2Z1)(X1Z2+X2Z1)
[0167] Y3=(Y1Y2+3Z1Z2)(Y1Y2-3Z1Z2)-9X1X2(X1Z2+X2Z2)
[0168] Z3=(Y1Z2+Y2Z1)(Y1Y2+3Z1Z2)+3X1X2(X1Y2+X2Y1)
[0169] (X1, Y1, Z1) are the coordinates of the first elliptic curve point, (X2, Y2, Z2) are the coordinates of the second elliptic curve point, and (X3, Y3, Z3) are the coordinates of the new elliptic curve point.
[0170] In one embodiment, after the processor receives scalars and elliptic curve points transmitted by the arbiter and the elliptic curve point adder respectively, and determines whether the target buckets accessed by the two elliptic curve points are the same, it is further configured to implement:
[0171] When the target buckets accessed by the two elliptic curve points are the same, an addition request is generated based on the arbitrator and the two sets of scalars and elliptic curve points, and the addition request is distributed to the multiplexer.
[0172] In one embodiment, after the processor receives a scalar and an elliptic curve point in the bucket status register table, determines the number of accesses to the target bucket for the two elliptic curve points based on the scalar, and updates the read / write status of the two target buckets based on the number of accesses, the processor is further configured to:
[0173] When the read and write states of the target bucket are different, an addition request is generated based on the bucket module and two sets of scalar and elliptic curve points, and the addition request is transmitted to the multiplexer.
[0174] In one embodiment, before the processor receives the scalar and elliptic curve points transmitted by the arbiter and the elliptic curve point adder respectively, and determines whether the target buckets accessed by the two elliptic curve points are the same, it is also configured to implement:
[0175] The system receives scalar and elliptic curve points input by the user based on the first-in-first-out queue, and performs bit-width alignment on the scalar.
[0176] According to the preset reading rules, scalar and elliptic curve points are read into the arbitrator.
[0177] The embodiments of this application also provide a computer-readable storage medium storing a computer program, the computer program including program instructions, and the processor executing the program instructions to implement any of the multi-scalar multiplication operation optimization methods provided in the embodiments of this application.
[0178] The computer-readable storage medium may be an internal storage unit of the computer device described in the foregoing embodiments, such as the hard disk or memory of the computer device. The computer-readable storage medium may also be an external storage device of the computer device, such as a plug-in hard disk, SmartMedia Card (SMC), Secure Digital (SD) card, or Flash Card equipped on the computer device.
[0179] The above description is merely a specific embodiment of this application, but the scope of protection of this application is not limited thereto. Any person skilled in the art can easily conceive of various equivalent modifications or substitutions within the technical scope disclosed in this application, and these modifications or substitutions should all be covered within the scope of protection of this application. Therefore, the scope of protection of this application should be determined by the scope of the claims.
Claims
1. An optimized method for multi-scalar multiplication, characterized in that, The optimization method is applied to a multi-scalar multiplication system, which includes a first-in-first-out queue, an arbiter, a bucket status register table, a bucket module, a buffer, a multiplexer, and an elliptic curve point adder. The bucket module contains at least one bucket. The optimization method includes: The arbiter receives scalars and elliptic curve points transmitted by the first-in-first-out queue and the elliptic curve point adder, respectively, and determines whether the target buckets accessed by the two elliptic curve points are the same. When the target buckets accessed by the two elliptic curve points are different, the scalar is analyzed based on the bucket status register table to determine the number of times the two elliptic curve points access the target bucket, and the read / write status of the two target buckets is updated based on the number of accesses. When the bucket module receives scalar and elliptic curve points, it controls the scalar and elliptic curve points to access the target bucket according to the read / write status and the number of accesses. When the read / write status of the two target buckets is the same, the buffer is activated and the addition request generated based on the two sets of scalar and elliptic curve points is stored in the buffer. Based on the multiplexer, the request to be processed is determined from the received addition requests, and the request to be processed is transmitted to the elliptic curve point adder; The elliptic curve point adder processes the request to be processed according to the preset three-coordinate operation formula to obtain new scalars and elliptic curve points, and transmits the new scalars and elliptic curve points to the arbitrator for the next round of loop processing with the scalars and elliptic curve points in the first-in-first-out queue. When the first-in-first-out queue is empty, the loop processing ends, and bucket aggregation and group aggregation are performed based on the bucket status register table to obtain the calculation results.
2. The optimization method for multi-scalar multiplication according to claim 1, characterized in that, The step of processing the request based on the elliptic curve point adder according to a preset three-coordinate calculation formula to obtain new elliptic curve points includes: The request to be processed is analyzed based on the elliptic curve point adder, and the coordinates of the two elliptic curve points are obtained respectively, wherein the coordinates are represented by a three-coordinate system. Based on the large number modular multiplication module, large number modular addition module, and large number modular subtraction module in the elliptic curve point adder, point operations are performed on the three-coordinate calculation formula and the coordinates of the two points to obtain new elliptic curve points.
3. The optimization method for multi-scalar multiplication operations according to claim 2, characterized in that, The method based on the large number modular multiplication module, large number modular addition module, and large number modular subtraction module in the elliptic curve point adder performs point operations on the three-coordinate calculation formula and the coordinates of the two points to obtain new elliptic curve points, including: Based on the three-coordinate calculation formula and the point coordinates, a calculation task is generated; Based on the computational attributes, the computational task is split to obtain at least one computational subtask; The large number modular multiplication module, the large number modular addition module, and the large number modular subtraction module are used to perform parallel calculations on the operation subtasks to obtain the new elliptic curve points.
4. The optimization method for multi-scalar multiplication operations according to claim 2, characterized in that, The three-coordinate calculation formula is as follows: Let these be the coordinates of the first point on the elliptic curve. Let these be the coordinates of the point on the second elliptic curve. Let these be the coordinates of the new elliptic curve points.
5. The optimized method for multi-scalar multiplication according to claim 1, characterized in that, After the arbiter receives the scalar and elliptic curve points transmitted by the first-in-first-out queue and the elliptic curve point adder, respectively, and determines whether the target buckets accessed by the two elliptic curve points are the same, the method further includes: When the target buckets accessed by the two elliptic curve points are the same, an addition request is generated based on the arbitrator and the two sets of scalars and elliptic curve points, and the addition request is distributed to the multiplexer.
6. The optimization method for multi-scalar multiplication according to claim 5, characterized in that, After receiving a scalar and an elliptic curve point in the bucket status register table, determining the number of accesses to the target bucket by the two elliptic curve points based on the scalar, and updating the read / write status of the two target buckets based on the number of accesses, the method further includes: When the read and write states of the target bucket are different, an addition request is generated based on the bucket module and two sets of scalar and elliptic curve points, and the addition request is transmitted to the multiplexer.
7. The optimized method for multi-scalar multiplication according to any one of claims 1-6, characterized in that, Before the step of receiving the scalar and elliptic curve points transmitted by the arbiter from the first-in-first-out queue and the elliptic curve point adder, and determining whether the target buckets accessed by the two elliptic curve points are the same, the method further includes: The system receives scalar and elliptic curve points input by the user based on the first-in-first-out queue, and performs bit-width alignment on the scalar. According to the preset reading rules, scalar and elliptic curve points are read into the arbitrator.
8. An optimized device for multi-scalar multiplication operations, characterized in that, The optimization device includes a first-in-first-out queue, an arbitrator, a bucket status register table, a bucket module, a buffer, a multiplexer, and an elliptic curve point adder, and also includes: The target bucket determination module is used to determine whether the target buckets accessed by the two elliptic curve points are the same, based on the arbitrator receiving the scalar and elliptic curve points transmitted by the first-in-first-out queue and the elliptic curve point adder, respectively. The read / write status update module is used to analyze the scalar based on the bucket status register table when the target buckets accessed by the two elliptic curve points are different, to determine the number of times the two elliptic curve points access the target buckets, and to update the read / write status of the two target buckets based on the number of accesses respectively. An addition request generation module is used to control the scalar and elliptic curve points to access the target bucket according to the read / write status and the number of accesses when the bucket module receives scalar and elliptic curve points, and to activate the buffer when the read / write status of the two target buckets is the same, and to store the addition requests generated based on the two sets of scalar and elliptic curve points in the buffer. The pending request determination module is used to determine the pending request from the received addition requests based on the multiplexer, and transmit the pending request to the elliptic curve point adder. The addition request processing module is used to process the request to be processed according to the preset three-coordinate operation formula based on the elliptic curve point adder to obtain new scalar and elliptic curve points, and transmit the new scalar and elliptic curve points to the arbitrator for the next round of loop processing with the scalar and elliptic curve points in the first-in-first-out queue. The calculation result acquisition module is used to end the loop processing when the first-in-first-out queue is empty, and perform bucket aggregation and group aggregation processing based on the bucket status register table to obtain the calculation result.
9. A computer device, characterized in that, The computer device includes a memory and a processor; The memory is used to store computer programs; The processor is configured to execute the computer program and, when executing the computer program, implement the optimized method for multi-scalar multiplication as described in any one of claims 1 to 7.
10. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores a computer program that, when executed by a processor, causes the processor to implement an optimized method for multiscalar multiplication as described in any one of claims 1 to 7.
Citation Information
Patent Citations
Elliptic curve point and hardware acceleration method and device
CN115344525A
Multi-scalar multiplier and acceleration method
CN116954559A