Skip to main content
. 2021 Apr 19;21(8):2859. doi: 10.3390/s21082859
Algorithm 5 Fixed-Q Product method.
Input: s=6t+2, m= the bit length of s, P={(P1,…,Pd)∣Pj∈G1}, Q′={(Q1′,…,Qd′)∣Qj′ is the precomputation tuple for Qj∈G2}
Output: eprod(P,Q)
  • 1:

    Write s in signed binary form, s=∑i=0m−1s[i]2i with s[i]∈{−1,0,1}

  • 2:

    f←1

  • 3:

    forj←1toddo

  • 4:

        cnt[j]←1

  • 5:

    end for

  • 6:

    fori←m−2down to 0 do

  • 7:

        f←f2

  • 8:

        for j←1 to d do

  • 9:

            GDBL,GADD←Qj′

  • 10:

            λ,c←GDBL[i]

  • 11:

            Compute g←(yP+λxP+c)

  • 12:

            f←f·g

  • 13:

            if s[i]≠0 then

  • 14:

               λ,c←GADD[cnt[j]]

  • 15:

               Compute g←(yP+λxP+c)

  • 16:

               cnt[j]←cnt[j]+1

  • 17:

               f←f·g

  • 18:

            end if

  • 19:

        end for

  • 20:

    end for

  • 21:

    forj←1toddo

  • 22:

        π′Q,(π′)Q2←Qj′

  • 23:

        λ,c←π′Q

  • 24:

        Compute g←(yP+λxP+c)

  • 25:

        f←f·g

  • 26:

        λ,c←(π′)2Q

  • 27:

        Compute g←(yP+λxP+c)

  • 28:

        f←f·g

  • 29:

    end for

  • 30:

    f←f(p12−1)/r

  • 31:

    returnf