Skip to main content
. 2021 Apr 19;21(8):2859. doi: 10.3390/s21082859
Algorithm 2 Products of optimal Ate pairings on the BN curve (Product method).
Input: s=6t+2, m= the bit length of s, PjG1, QjG2, where j is 1,,d
Output: eprod(P,Q)
  • 1:

    Write s in signed binary form, s=i=0m1s[i]2i with s[i]{1,0,1}

  • 2:

    f1

  • 3:

    forj1tondo

  • 4:

        TjQj

  • 5:

    end for

  • 6:

    forim2down to 0 do

  • 7:

        ff2

  • 8:

        for j1 to d do

  • 9:

            ff·LTj,Tj(Pj),Tj[2]Tj

  • 10:

            if s[i]=1 then

  • 11:

               ff·LTj,Qj(Pj),TjTj+Qj

  • 12:

            else if s[i]=1 then

  • 13:

               ff·LTj,Qj(Pj),TjTjQj

  • 14:

            end if

  • 15:

        end for

  • 16:

    end for

  • 17:

    forj1toddo

  • 18:

        Rπ(Qj),ff·LTj,R(Pj),TjTj+R

  • 19:

        Rπ2(Qj),ff·LTj,R(Pj),TjTjR

  • 20:

    end for

  • 21:

    ff(p121)/r

  • 22:

    returnf