1. Montgomery curve定义

Montgomery curve为椭圆曲线的一种,基于Fq的仿射方程表示为:
E(A;B):By2=x(x2+Ax+1) E(A;B) : By^2 = x(x^2 + Ax + 1)
其中参数A和B为在域Fq内的值,同时满足 B != 0, A2 != 4。

将上述方程转换为投影坐标系下(X : Y : Z),其中x = X/Z, y = Y/Z,则对应的投影模型:
E(A;B):BY2Z=X(X2+AXZ+Z2)P2 E(A;B) : BY^2Z = X(X^2 + AXZ + Z^2) \subseteq P^2

对于投影模型的表示下,E(A;B) 上有一个无穷远点 O = (0 : 1 : 0),该点位E(A;B) 上唯一的一个Z=0点。

2. P1上的快速微分运算

在投影坐标系下,quotient map(商映射关系) F:E(A;B)E/<>=P1F:E(A;B) \mapsto E/<\ominus >=P^1 为:
F:P{(xp:1)ifP=(xp:yp:1)(1:0)ifP=O=(0:1:0)F:P\mapsto\left\{\begin{matrix} (x_p:1) & if &P=(x_p:y_p:1) \\ (1:0)& if &P=O=(0:1:0) \end{matrix}\right.

F((X:Y:Z))=(X:Z)F((X:Y:Z))=(X:Z)仅对Z!=0的情况成立。对于无穷远点O=(0:1:0),(0:0)不是投影坐标点。
T=(0:0:1)。

2.1 P1上的伪运算

{F(P),F(Q),F(PQ),F(PQ)}\begin{Bmatrix} F(P),F(Q),F(P\oplus Q),F(P\ominus Q) \end{Bmatrix}
上面集合中知道任意三个值,即可计算出第四个值。

  • 伪加法运算——FADD:(F(P),F(Q),F(PQ))F(PQ)F_{ADD}:(F(P),F(Q),F(P\ominus Q)) \mapsto F(P\oplus Q)
  • 当P=Q时,即为伪double运算——FDBL:F(P)F([2]P)F_{DBL}:F(P) \mapsto F([2]P)

以上的伪加法和伪double运算为高效伪乘法运算的基础。

假设P=(xp,yp),Q=(xq,yq),xp!=0,xq!=0P=(x_p,y_p), Q=(x_q,y_q), 且x_p!=0, x_q!=0

  • 当P!=Q时,Montgomery发现P,Q,PQ,PQP, Q, P\oplus Q,P\ominus Q这四个点的x坐标值存在如下关系:
    xPQxPQ(xPxQ)2=(xPxQ1)2x_{P\oplus Q}x_{P\ominus Q}(x_P-x_Q)^2=(x_Px_Q-1)^2

  • 当P=Q时,将[2]P表示为[2]P=(x[2]P,y[2]P)[2]P=(x_{[2]P},y_{[2]P}),则有
    4x[2]PxP(xP2+AxP+1)=(xP21)24x_{[2]P}x_P(x_P^2+Ax_P+1)=(x_P^2-1)^2

以上两个公式对于Weierstrass模型也成立,只是不如Montgomery curve直观。

具体计算细节参见论文《Speeding the Pollard and Elliptic Curve Methods of Factorization》
Montgomery curve的运算(1)——add/double运算
Montgomery curve的运算(1)——add/double运算

2.2 P1上的伪加法运算

实际运算时,更多关注已知F(P),F(Q),F(PQ)F(P),F(Q),F(P\ominus Q)求解F(PQ)F(P\oplus Q),即对伪加法运算的获取。
假设P!=Q且PQ!=TP\ominus Q != T,根据第2节公式定义有:
(XP:ZP):=F(P),(XQ:ZQ):=F(Q),(X:Z):=F(PQ),(X:Z):=F(PQ) (X_P:Z_P):=F(P) ,\quad (X_Q:Z_Q):=F(Q), \quad (X_{\oplus}:Z_{\oplus}):=F(P\oplus Q), \quad (X_{\ominus}:Z_{\ominus}):=F(P\ominus Q)

根据假设,可知PQ{O,T}P\ominus Q \notin \{O,T\},所以X!=0,Z!=0X_{\ominus} != 0, Z_{\ominus} != 0
在投影坐标系下(X:Y:Z)下计算,因为x=X/Z,y=Y/Z,E(A;B):BY2Z=X(X2+AXZ+Z2)P2x = X/Z, y = Y/Z, E(A;B) : BY^2Z = X(X^2 + AXZ + Z^2) \subseteq P^2,对于:
xPQxPQ(xPxQ)2=(xPxQ1)2x_{P\oplus Q}x_{P\ominus Q}(x_P-x_Q)^2=(x_Px_Q-1)^2
可转换为:
XZXZ(XPZPXQZQ)2=(XPZPXQZQ1)2\frac{X_{\oplus}}{Z_{\oplus}}\frac{X_{\ominus}}{Z_{\ominus}}(\frac{X_P}{Z_P}-\frac{X_Q}{Z_Q})^2=(\frac{X_P}{Z_P}\frac{X_Q}{Z_Q}-1)^2
约简为:
XZ=ZX(XPZPXQZQ)2(XPZQXQZP)2=Z[(XPZP)(XQ+ZQ)+(XP+ZP)(XQZQ)]2X[(XPZP)(XQ+ZQ)(XP+ZP)(XQZQ)]2\frac{X_{\oplus}}{Z_{\oplus}} = \frac{Z_{\ominus}}{X_{\ominus}}\frac{({X_P}{Z_P}-{X_Q}{Z_Q})^2}{({X_P}{Z_Q}-{X_Q}{Z_P})^2}=\frac{Z_{\ominus}[(X_P-Z_P)(X_Q+Z_Q)+(X_P+Z_P)(X_Q-Z_Q)]^2}{X_{\ominus}[(X_P-Z_P)(X_Q+Z_Q)-(X_P+Z_P)(X_Q-Z_Q)]^2}
相应地,可计算(X,Z)(X_{\oplus}, Z_{\oplus})
{X=Z[(XPZP)(XQ+ZQ)+(XP+ZP)(XQZQ)]2Z=X[(XPZP)(XQ+ZQ)(XP+ZP)(XQZQ)]2 \left\{\begin{matrix} X_{\oplus}=Z_{\ominus}[(X_P-Z_P)(X_Q+Z_Q)+(X_P+Z_P)(X_Q-Z_Q)]^2\\ Z_{\oplus}=X_{\ominus}[(X_P-Z_P)(X_Q+Z_Q)-(X_P+Z_P)(X_Q-Z_Q)]^2 \end{matrix}\right.

F(PQ)F(P\ominus Q)的“difference”为固定的,则可归一化为(XP:1)(X_P:1)

伪加法运算中,与曲线参数A,B均无关。

具体的算法实现可如下:
Montgomery curve的运算(1)——add/double运算

2.3 P1上的伪double运算

可参见2.2节中类似的公式转换,可计算(X[2]P,Z[2]P)(X_{[2]P},Z_{[2]P})
{X[2]P=(XP+ZP)2(XPZP)2Z[2]P=(4XPZP)[(XPZP)2+(A+2)4(4XPZP)] \left\{\begin{matrix} X_{[2]P}=(X_P+Z_P)^2(X_P-Z_P)^2\\ Z_{[2]P}=(4X_PZ_P)[(X_P-Z_P)^2+\frac{(A+2)}{4}(4X_PZ_P)] \end{matrix}\right.
其中:
4XpZP=(XP+ZP)2(XPZP)24X_pZ_P=(X_P+Z_P)^2-(X_P-Z_P)^2

伪double运算中,X的值与曲线参数A,B均无关;Z的值仅使用了曲线的参数A,与曲线参数B无关。

相应的算法实现如下:
Montgomery curve的运算(1)——add/double运算
上面算法的步骤7中,做的是一个与常量(A+2)/4(A+2)/4的乘积运算。因此实际A参数越小,越能减少该常量乘积运算的开销。

参考资料:
[1] 论文《Speeding the Pollard and Elliptic Curve Methods of Factorization》
[2] 论文《Montgomery curves and their arithmetic》

相关文章:

  • 2021-07-02
  • 2022-12-23
  • 2021-11-19
  • 2021-12-06
  • 2021-06-29
  • 2021-10-01
猜你喜欢
  • 2022-02-24
  • 2021-05-01
  • 2021-11-18
  • 2022-12-23
  • 2021-11-11
  • 2022-01-21
  • 2021-12-05
相关资源
相似解决方案