# A Unified Point Multiplication Architecture of Weierstrass, Edward and Huff Elliptic Curves on FPGA
## 2 Mathematical Background over \(GF(2^{m})\)
Algorithms 1 and 3 compute PM in (Lopez Dahab) projective coordinates while our implemented Algorithm 2 executes the PM in a differential coordinate system. After transforming the coordinates, the PM is implemented (using the statements inside the \(for\) loop of Algorithms 1-3). A \(k_{i}\) in Algorithms 1-3 is the bit stream of the scalar multiplier, which determines the execution of the corresponding PA and PD operations. The corresponding PA and PD formulations of Weierstrass, Edward, and Huff curves for PM computations are listed in Table 1. The column provides the number of instructions. Column two presents the PA and PD instructions for the Weierstrass model of ECC. Similarly, the unified addition instructions for Edward (\(UADD_{Edw}\)) and Huff (\(UADD_{Huff}\)) curves are shown in columns three and four of Table 1.  
```
Input:\(k=(k_{n-1},\ldots,k_{1},k_{0})\) with \(k_{n-1}=1\), \(P=(x_{p},y_{p})\in GF(2^{m})\) Output:\(Q=(x_{q},y_{q})=k\cdot P\) Affine to projective conversions:\(X_{1}=x_{p}\), \(Z_{1}=1\), \(Z_{2}=x_{p}^{2}\) and \(X_{2}=x_{p}^{4}+b\) PM in projective coordinates: for(i from m-2 down to 0)do if(\(k_{j}=1\))then \(PA(X_{1},Z_{1})=(X_{1},Z_{1},X_{2},Z_{2})\) and \(PD(X_{2},Z_{2})=(X_{2},Z_{2})\) else \(PA(X_{2},Z_{2})=(X_{2},Z_{2},X_{1},Z_{1})\) and \(PD(X_{1},Z_{1})=(X_{1},Z_{1})\) end if end for end Reconversion from projective to affine:\(x_{q}=\frac{X_{1}}{Z_{1}},y_{q}=x_{p}+(\frac{X_{1}}{Z_{1}})[(X_{1}+x_{p}\times Z _{1})(X_{2}+x_{p}\times Z_{2})+(x_{p}^{2}+y_{p})(Z_{1}\times Z_{2})](x_{p} \times Z_{1}\times Z_{2})^{-1}+y_{p}\)
```  
**Algorithm 1**Montgomery PM algorithm for Weierstrass curve [9; 11]. ```
Input:\(E_{B,d1,d2}/GF(2^{m}):d1(x+y)+d2(x+y)^{2}=xy(x+1)(y+1)\), \(P\in E_{B,d1,d2}\) and \(k=(k_{m-1},\ldots,k_{1},k_{0})\) Output:\(Q=w(k.P)\) Affine to \(\omega\) conversions:\(W_{1}=0\), \(Z_{1}=1\), \(W_{2}=w(P)\) and \(Z_{2}=w(P)\) PM in \(\omega\) coordinates: for(i from m-2 down to 0)do if(\(k_{i}=0\))then \(((W_{1}:Z_{1}),(W_{2}:Z_{2})):=UADD_{Edm}((W_{0}:Z_{0}),(W_{1}:Z_{1}),(W_{2}:Z_{ 2}))\) else \(((W_{2}:Z_{2}),(W_{1}:Z_{1})):=UADD_{Edm}((W_{0}:Z_{0}),(W_{2}:Z_{2}),(W_{1}:Z_{ 1}))\) end if end for end Return:\((W_{1}:Z_{1}),(W_{2}:Z_{2})\)
```  
**Algorithm 2**Montgomery PM algorithm for Edward curve [16]. ```
Input:\(k=(k_{n-1},\ldots,k_{1},k_{0})\) with \(k_{n-1}=1\), \(P=(x,y)\in GF(2^{m})\) Output:\(Q=\omega(k.P)\) Affine to projective conversions:\(X_{1}=x_{p}\), \(Y_{1}=Y_{2}=y_{p}\), \(Z_{1}=1\), \(X_{2}=x_{p}^{4}+b\) and \(Z_{2}=x_{p}^{2}\) PM in projective coordinates: for(i from m-2 down to 0)do \(Q=UADD_{Huff}(Q,Q)\) if(\(k_{i}=1\))then \(Q=UADD_{Huff}(P,Q)\) end for end for Reconversion from projective to affine:\(Q(x_{q},y_{q})=(\frac{X_{2}}{Z_{2}},\frac{Y_{2}}{Z_{2}^{2}})\)
```  
**Algorithm 3**Double and Add PM algorithm for Huff curve [17]. ```
Input:\(k=(k_{n-1},\ldots,k_{1},k_{0})\) with \(k_{n-1}=1\), \(P=(x,y)\in GF(2^{m})\) Output:\(Q=\omega(k.P)\) Affine to projective conversions:\(X_{1}=x_{p}\), \(Y_{1}=Y_{2}=y_{p}\), \(Z_{1}=1\), \(X_{2}=x_{p}^{4}+b\) and \(Z_{2}=x_{p}^{2}\) PM in projective coordinates: for(i from m-2 down to 0)do \(Q=UADD_{Huff}(Q,Q)\) if(\(k_{i}=1\))then \(Q=UADD_{Huff}(P,Q)\) end for end Reconversion from projective to affine:\(Q(x_{q},y_{q})=(\frac{X_{2}}{Z_{2}},\frac{Y_{2}}{Z_{2}^{2}})\)
```  
**Algorithm 4**Double and Add PM algorithm for Huff curve [17].