/* GLV method */ public static BIG[] Glv(BIG e) { BIG[] u = new BIG[2]; if (ECP.CURVE_PAIRING_TYPE == ECP.BN) { int i, j; BIG t = new BIG(0); BIG q = new BIG(ROM.CURVE_Order); BIG[] v = new BIG[2]; for (i = 0; i < 2; i++) { t.Copy(new BIG(ROM.CURVE_W[i])); // why not just t=new BIG(ROM.CURVE_W[i]); DBIG d = BIG.Mul(t, e); v[i] = new BIG(d.Div(q)); u[i] = new BIG(0); } u[0].Copy(e); for (i = 0; i < 2; i++) { for (j = 0; j < 2; j++) { t.Copy(new BIG(ROM.CURVE_SB[j][i])); t.Copy(BIG.ModMul(v[j], t, q)); u[i].Add(q); u[i].Sub(t); u[i].Mod(q); } } } else { // -(x^2).P = (Beta.x,y) BIG q = new BIG(ROM.CURVE_Order); BIG x = new BIG(ROM.CURVE_Bnx); BIG x2 = BIG.SMul(x, x); u[0] = new BIG(e); u[0].Mod(x2); u[1] = new BIG(e); u[1].Div(x2); u[1].RSub(q); } return(u); }