Pippenger Algorithm
Pipenger Algorithm or Bucket Method is an algorithm to compute MSM efficiently.
The multi-scalar multiplication (MSM) problem is: Given n elliptic curve points Gi and n scalars si, compute:
where siGi denotes scalar multiplication.
Description
Let’s first partition each scalar into m windows each has c bits, then:
You can think of each scalar si as a big number so this is just a representation of it as a multi-precision integer with a limb size equal to c.
Then we have:
By reordering the sums and denoting Wj=∑i=0nsi,jGi, we get:
It means we can calculate the MSM for each window Wj first, and then aggregate the results.
Because each window has c bits, si,j has a value in range [0,2c−1]. Therefore, we can put n points into 2c buckets according to the value of si,j. Using this fact we can compute Wj in the following way:
for each bucket t∈{0,2c−1}: calculate the sum of points in this bucket to get Bt
for each j compute Wj: Wj=∑t=02c−1tBt
For example, if c=3 and n=15, then we have 15 points and 8 buckets, such that:
Algorithm
Here:
n - number of terms
c - size of window in bits
m - number of windows
Init windows Wj, j∈{0..m} with additive identities
For each j in 0..m:
Init buckets Bt, t∈{0..2c−1}with additive identities
For each i in 0..n:
Compute si,j:
Shift si right on cj bits
Compute remainder modulo 2c
Add Gi to a bucket Bsi,j
Compute partial sum: Wj=∑t=02c−1tBt
Compute final sum: S=∑j=0m−12jcWj
Sage example:
Last updated