Skip to main content
. 2018 Jan 16;18(1):251. doi: 10.3390/s18010251
Algorithm 2 Montgomery ladder over projective coordinates, making explicit field operations
Require: k, P(x,y)
Ensure: kP
    1: X1←x,Z1←1,X2←x4+b,Z2←x2.Compute(P,2P)
    2: for i=m−2downto0 do
    3:  if ki=0 then
    4:   T←Z2,Z2←(X1Z2+X2Z1)2,X2←xZ2+X1X2Z1T
    5:   T←X1,X1←X14+bZ14,Z1←T2Z12
    6:  else
    7:   T←Z1,Z1←(X1Z2+X2Z1)2,X1←xZ1+X1X2TZ2
    8:   T←X2,X2←X24+bZ24,Z2←T2Z22
    9:  end if
  10: end for
  11: x3←X1/Z1
  12: y3←(x+X1/Z1)[(X1+xZ1)(X2+xZ2)+(x2+y)(Z1Z2)](xZ1Z2)−1+y
  13: return (x3,y3)