public ECFieldElement multiply(ECFieldElement b) { int[] z = Nat256.create(); SM2P256V1Field.multiply(x, ((SM2P256V1FieldElement)b).x, z); return new SM2P256V1FieldElement(z); }
SM2P256V1Field.multiply(S2, X2.x, U2); SM2P256V1Field.multiply(S2, Z1.x, S2); SM2P256V1Field.multiply(S2, Y2.x, S2); SM2P256V1Field.multiply(S1, X1.x, U1); SM2P256V1Field.multiply(S1, Z2.x, S1); SM2P256V1Field.multiply(S1, Y1.x, S1); SM2P256V1Field.multiply(HSquared, H, G); SM2P256V1Field.multiply(HSquared, U1, V); if (!Z1IsOne) SM2P256V1Field.multiply(Z3.x, Z1.x, Z3.x); SM2P256V1Field.multiply(Z3.x, Z2.x, Z3.x);
public ECFieldElement divide(ECFieldElement b) { // return multiply(b.invert()); int[] z = Nat256.create(); Mod.invert(SM2P256V1Field.P, ((SM2P256V1FieldElement)b).x, z); SM2P256V1Field.multiply(z, x, z); return new SM2P256V1FieldElement(z); }
SM2P256V1Field.multiply(x2, x1, x2); int[] x4 = Nat256.create(); SM2P256V1Field.squareN(x2, 2, x4); SM2P256V1Field.multiply(x4, x2, x4); int[] x6 = Nat256.create(); SM2P256V1Field.squareN(x4, 2, x6); SM2P256V1Field.multiply(x6, x2, x6); int[] x12 = x2; SM2P256V1Field.squareN(x6, 6, x12); SM2P256V1Field.multiply(x12, x6, x12); int[] x24 = Nat256.create(); SM2P256V1Field.squareN(x12, 12, x24); SM2P256V1Field.multiply(x24, x12, x24); int[] x30 = x12; SM2P256V1Field.squareN(x24, 6, x30); SM2P256V1Field.multiply(x30, x6, x30); int[] x31 = x6; SM2P256V1Field.square(x30, x31); SM2P256V1Field.multiply(x31, x1, x31); SM2P256V1Field.multiply(t1, x31, x62); SM2P256V1Field.multiply(t1, x62, t1); SM2P256V1Field.squareN(t1, 62, t1); SM2P256V1Field.multiply(t1, x62, t1); SM2P256V1Field.squareN(t1, 4, t1); SM2P256V1Field.multiply(t1, x4, t1); SM2P256V1Field.squareN(t1, 32, t1); SM2P256V1Field.multiply(t1, x1, t1);
SM2P256V1Field.multiply(M, t1, M); c = Nat256.addBothTo(M, M, M); SM2P256V1Field.reduce32(c, M); SM2P256V1Field.multiply(Y1Squared, X1.x, S); c = Nat.shiftUpBits(8, S, 2, 0); SM2P256V1Field.reduce32(c, S); SM2P256V1Field.multiply(Y3.x, M, Y3.x); SM2P256V1Field.subtract(Y3.x, t1, Y3.x); if (!Z1IsOne) SM2P256V1Field.multiply(Z3.x, Z1.x, Z3.x);