feSq2 static method
Implementation
static void feSq2(FieldElement h, FieldElement f) {
final int f0 = f.h[0];
final int f1 = f.h[1];
final int f2 = f.h[2];
final int f3 = f.h[3];
final int f4 = f.h[4];
final int f5 = f.h[5];
final int f6 = f.h[6];
final int f7 = f.h[7];
final int f8 = f.h[8];
final int f9 = f.h[9];
final int f0_2 = (2 * f0).toInt32;
final int f1_2 = (2 * f1).toInt32;
final int f2_2 = (2 * f2).toInt32;
final int f3_2 = (2 * f3).toInt32;
final int f4_2 = (2 * f4).toInt32;
final int f5_2 = (2 * f5).toInt32;
final int f6_2 = (2 * f6).toInt32;
final int f7_2 = (2 * f7).toInt32;
final int f5_38 = (38 * f5).toInt32; /* 1.959375*2^30 */
final int f6_19 = (19 * f6).toInt32; /* 1.959375*2^30 */
final int f7_38 = (38 * f7).toInt32; /* 1.959375*2^30 */
final int f8_19 = (19 * f8).toInt32; /* 1.959375*2^30 */
final int f9_38 = (38 * f9).toInt32; /* 1.959375*2^30 */
final BigInt f0f0 = f0.toBig * f0.toBig;
final BigInt f0f1_2 = f0_2.toBig * f1.toBig;
final BigInt f0f2_2 = f0_2.toBig * f2.toBig;
final BigInt f0f3_2 = f0_2.toBig * f3.toBig;
final BigInt f0f4_2 = f0_2.toBig * f4.toBig;
final BigInt f0f5_2 = f0_2.toBig * f5.toBig;
final BigInt f0f6_2 = f0_2.toBig * f6.toBig;
final BigInt f0f7_2 = f0_2.toBig * f7.toBig;
final BigInt f0f8_2 = f0_2.toBig * f8.toBig;
final BigInt f0f9_2 = f0_2.toBig * f9.toBig;
final BigInt f1f1_2 = f1_2.toBig * f1.toBig;
final BigInt f1f2_2 = f1_2.toBig * f2.toBig;
final BigInt f1f3_4 = f1_2.toBig * f3_2.toBig;
final BigInt f1f4_2 = f1_2.toBig * f4.toBig;
final BigInt f1f5_4 = f1_2.toBig * f5_2.toBig;
final BigInt f1f6_2 = f1_2.toBig * f6.toBig;
final BigInt f1f7_4 = f1_2.toBig * f7_2.toBig;
final BigInt f1f8_2 = f1_2.toBig * f8.toBig;
final BigInt f1f9_76 = f1_2.toBig * f9_38.toBig;
final BigInt f2f2 = f2.toBig * f2.toBig;
final BigInt f2f3_2 = f2_2.toBig * f3.toBig;
final BigInt f2f4_2 = f2_2.toBig * f4.toBig;
final BigInt f2f5_2 = f2_2.toBig * f5.toBig;
final BigInt f2f6_2 = f2_2.toBig * f6.toBig;
final BigInt f2f7_2 = f2_2.toBig * f7.toBig;
final BigInt f2f8_38 = f2_2.toBig * f8_19.toBig;
final BigInt f2f9_38 = f2.toBig * f9_38.toBig;
final BigInt f3f3_2 = f3_2.toBig * f3.toBig;
final BigInt f3f4_2 = f3_2.toBig * f4.toBig;
final BigInt f3f5_4 = f3_2.toBig * f5_2.toBig;
final BigInt f3f6_2 = f3_2.toBig * f6.toBig;
final BigInt f3f7_76 = f3_2.toBig * f7_38.toBig;
final BigInt f3f8_38 = f3_2.toBig * f8_19.toBig;
final BigInt f3f9_76 = f3_2.toBig * f9_38.toBig;
final BigInt f4f4 = f4.toBig * f4.toBig;
final BigInt f4f5_2 = f4_2.toBig * f5.toBig;
final BigInt f4f6_38 = f4_2.toBig * f6_19.toBig;
final BigInt f4f7_38 = f4.toBig * f7_38.toBig;
final BigInt f4f8_38 = f4_2.toBig * f8_19.toBig;
final BigInt f4f9_38 = f4.toBig * f9_38.toBig;
final BigInt f5f5_38 = f5.toBig * f5_38.toBig;
final BigInt f5f6_38 = f5_2.toBig * f6_19.toBig;
final BigInt f5f7_76 = f5_2.toBig * f7_38.toBig;
final BigInt f5f8_38 = f5_2.toBig * f8_19.toBig;
final BigInt f5f9_76 = f5_2.toBig * f9_38.toBig;
final BigInt f6f6_19 = f6.toBig * f6_19.toBig;
final BigInt f6f7_38 = f6.toBig * f7_38.toBig;
final BigInt f6f8_38 = f6_2.toBig * f8_19.toBig;
final BigInt f6f9_38 = f6.toBig * f9_38.toBig;
final BigInt f7f7_38 = f7.toBig * f7_38.toBig;
final BigInt f7f8_38 = f7_2.toBig * f8_19.toBig;
final BigInt f7f9_76 = f7_2.toBig * f9_38.toBig;
final BigInt f8f8_19 = f8.toBig * f8_19.toBig;
final BigInt f8f9_38 = f8.toBig * f9_38.toBig;
final BigInt f9f9_38 = f9.toBig * f9_38.toBig;
BigInt h0 = f0f0 + f1f9_76 + f2f8_38 + f3f7_76 + f4f6_38 + f5f5_38;
BigInt h1 = f0f1_2 + f2f9_38 + f3f8_38 + f4f7_38 + f5f6_38;
BigInt h2 = f0f2_2 + f1f1_2 + f3f9_76 + f4f8_38 + f5f7_76 + f6f6_19;
BigInt h3 = f0f3_2 + f1f2_2 + f4f9_38 + f5f8_38 + f6f7_38;
BigInt h4 = f0f4_2 + f1f3_4 + f2f2 + f5f9_76 + f6f8_38 + f7f7_38;
BigInt h5 = f0f5_2 + f1f4_2 + f2f3_2 + f6f9_38 + f7f8_38;
BigInt h6 = f0f6_2 + f1f5_4 + f2f4_2 + f3f3_2 + f7f9_76 + f8f8_19;
BigInt h7 = f0f7_2 + f1f6_2 + f2f5_2 + f3f4_2 + f8f9_38;
BigInt h8 = f0f8_2 + f1f7_4 + f2f6_2 + f3f5_4 + f4f4 + f9f9_38;
BigInt h9 = f0f9_2 + f1f8_2 + f2f7_2 + f3f6_2 + f4f5_2;
BigInt carry0;
BigInt carry1;
BigInt carry2;
BigInt carry3;
BigInt carry4;
BigInt carry5;
BigInt carry6;
BigInt carry7;
BigInt carry8;
BigInt carry9;
h0 += h0;
h1 += h1;
h2 += h2;
h3 += h3;
h4 += h4;
h5 += h5;
h6 += h6;
h7 += h7;
h8 += h8;
h9 += h9;
carry0 = (h0 + _bitMaskFor25) >> 26;
h1 += carry0;
h0 -= carry0 << 26;
carry4 = (h4 + _bitMaskFor25) >> 26;
h5 += carry4;
h4 -= carry4 << 26;
carry1 = (h1 + _bitMaskFor24) >> 25;
h2 += carry1;
h1 -= carry1 << 25;
carry5 = (h5 + _bitMaskFor24) >> 25;
h6 += carry5;
h5 -= carry5 << 25;
carry2 = (h2 + _bitMaskFor25) >> 26;
h3 += carry2;
h2 -= carry2 << 26;
carry6 = (h6 + _bitMaskFor25) >> 26;
h7 += carry6;
h6 -= carry6 << 26;
carry3 = (h3 + _bitMaskFor24) >> 25;
h4 += carry3;
h3 -= carry3 << 25;
carry7 = (h7 + _bitMaskFor24) >> 25;
h8 += carry7;
h7 -= carry7 << 25;
carry4 = (h4 + _bitMaskFor25) >> 26;
h5 += carry4;
h4 -= carry4 << 26;
carry8 = (h8 + _bitMaskFor25) >> 26;
h9 += carry8;
h8 -= carry8 << 26;
carry9 = (h9 + _bitMaskFor24) >> 25;
h0 += carry9 * BigInt.from(19);
h9 -= carry9 << 25;
carry0 = (h0 + _bitMaskFor25) >> 26;
h1 += carry0;
h0 -= carry0 << 26;
h.h[0] = h0.toInt32;
h.h[1] = h1.toInt32;
h.h[2] = h2.toInt32;
h.h[3] = h3.toInt32;
h.h[4] = h4.toInt32;
h.h[5] = h5.toInt32;
h.h[6] = h6.toInt32;
h.h[7] = h7.toInt32;
h.h[8] = h8.toInt32;
h.h[9] = h9.toInt32;
}