Try โ€‚โ€‰HackMD

Pippenger Algorithm for Multi-Scalar Multiplication (MSM)

Problem

Give

n scalars
ki
and
n
EC points
Pi
, calculate
P
such that
P=โˆ‘i=0nkiPi

The Pippenger / Bucket Algorithm

Step 1: partition scalars into windows

Let's first partition each scalar into

m windows each has
w
bits, then
ki=ki,0+ki,12w+...+ki,(mโˆ’1)2(mโˆ’1)w

You can think each scalar

ki as a bignum and representing it as a multi-precision integer with limb size
w
.

Then we have,

โˆ‘ikiPi=โˆ‘iโˆ‘j=0mโˆ’1ki,j2jwPi

By reordering the sums, we get

โˆ‘ikiPi=โˆ‘j2jw(โˆ‘iki,jPi)=โˆ‘j2jwWj

It means we can calculte the MSM for each window

Wj first, then aggregate the results via
โˆ‘j=0mโˆ’12jwWj

Then, let's examine

Wj=โˆ‘i=0nki,jPi

Step 2: for each window, add points by bucket

Because each window has

w bits,
ki,j
has a value range of
[0,2wโˆ’1]
. Therefore, we can put
n
points into
2w
buckets according to the value of
ki,j
. We can first calculate
Wj
by,

  1. for bucket
    t
    ,
    tโˆˆ{0,2wโˆ’1}
    , calculate the sum of points in this bucket and get
    Bt
  2. Wj=โˆ‘t=02wโˆ’1tBt

For example, if

w=3 and
n=15
, then we have
15
points,
8
buckets, such that
Wj=4P1+3P2+5P3+1P4+4P5+6P7+6P8+3P14+5P15=1P4+3(P2+P14)+4(P1+P5)+5(P3+P15)+6(P7+P8)=1B1+3B3+4B4+5B5+6B6

Therefore,

Wj=โˆ‘t=02wโˆ’1tBt

Step 3: reduce window results

P=โˆ‘i=0nkiPi=โˆ‘j2jwWj

Reference

https://www.notamonadtutorial.com/multiscalar-multiplication-strategies-and-challenges/

tags: msm zkp public