what-the-bank/sources/org/bouncycastle/math/raw/Nat224.java

899 lines
38 KiB
Java

package org.bouncycastle.math.raw;
import java.math.BigInteger;
import org.bouncycastle.asn1.cmp.PKIFailureInfo;
import org.bouncycastle.util.Pack;
/* loaded from: classes6.dex */
public abstract class Nat224 {
private static final long M = 4294967295L;
public static void zero(int[] iArr) {
iArr[0] = 0;
iArr[1] = 0;
iArr[2] = 0;
iArr[3] = 0;
iArr[4] = 0;
iArr[5] = 0;
iArr[6] = 0;
}
public static BigInteger toBigInteger(int[] iArr) {
byte[] bArr = new byte[28];
for (int i = 0; i < 7; i++) {
int i2 = iArr[i];
if (i2 != 0) {
Pack.intToBigEndian(i2, bArr, (6 - i) << 2);
}
}
return new BigInteger(1, bArr);
}
public static int subFrom(int[] iArr, int[] iArr2) {
long j = (iArr2[0] & 4294967295L) - (iArr[0] & 4294967295L);
iArr2[0] = (int) j;
long j2 = (j >> 32) + ((iArr2[1] & 4294967295L) - (iArr[1] & 4294967295L));
iArr2[1] = (int) j2;
long j3 = (j2 >> 32) + ((iArr2[2] & 4294967295L) - (iArr[2] & 4294967295L));
iArr2[2] = (int) j3;
long j4 = (j3 >> 32) + ((iArr2[3] & 4294967295L) - (iArr[3] & 4294967295L));
iArr2[3] = (int) j4;
long j5 = (j4 >> 32) + ((iArr2[4] & 4294967295L) - (iArr[4] & 4294967295L));
iArr2[4] = (int) j5;
long j6 = (j5 >> 32) + ((iArr2[5] & 4294967295L) - (iArr[5] & 4294967295L));
iArr2[5] = (int) j6;
long j7 = (j6 >> 32) + ((iArr2[6] & 4294967295L) - (4294967295L & iArr[6]));
iArr2[6] = (int) j7;
return (int) (j7 >> 32);
}
public static int subFrom(int[] iArr, int i, int[] iArr2, int i2) {
long j = (iArr2[i2] & 4294967295L) - (iArr[i] & 4294967295L);
iArr2[i2] = (int) j;
long j2 = (j >> 32) + ((iArr2[r4] & 4294967295L) - (iArr[i + 1] & 4294967295L));
iArr2[i2 + 1] = (int) j2;
long j3 = (j2 >> 32) + ((iArr2[r4] & 4294967295L) - (iArr[i + 2] & 4294967295L));
iArr2[i2 + 2] = (int) j3;
long j4 = (j3 >> 32) + ((iArr2[r4] & 4294967295L) - (iArr[i + 3] & 4294967295L));
iArr2[i2 + 3] = (int) j4;
long j5 = (j4 >> 32) + ((iArr2[r4] & 4294967295L) - (iArr[i + 4] & 4294967295L));
iArr2[i2 + 4] = (int) j5;
long j6 = (j5 >> 32) + ((iArr2[r4] & 4294967295L) - (iArr[i + 5] & 4294967295L));
iArr2[i2 + 5] = (int) j6;
long j7 = (j6 >> 32) + ((iArr2[r13] & 4294967295L) - (iArr[i + 6] & 4294967295L));
iArr2[i2 + 6] = (int) j7;
return (int) (j7 >> 32);
}
public static int subBothFrom(int[] iArr, int[] iArr2, int[] iArr3) {
long j = ((iArr3[0] & 4294967295L) - (iArr[0] & 4294967295L)) - (iArr2[0] & 4294967295L);
iArr3[0] = (int) j;
long j2 = (j >> 32) + (((iArr3[1] & 4294967295L) - (iArr[1] & 4294967295L)) - (iArr2[1] & 4294967295L));
iArr3[1] = (int) j2;
long j3 = (j2 >> 32) + (((iArr3[2] & 4294967295L) - (iArr[2] & 4294967295L)) - (iArr2[2] & 4294967295L));
iArr3[2] = (int) j3;
long j4 = (j3 >> 32) + (((iArr3[3] & 4294967295L) - (iArr[3] & 4294967295L)) - (iArr2[3] & 4294967295L));
iArr3[3] = (int) j4;
long j5 = (j4 >> 32) + (((iArr3[4] & 4294967295L) - (iArr[4] & 4294967295L)) - (iArr2[4] & 4294967295L));
iArr3[4] = (int) j5;
long j6 = (j5 >> 32) + (((iArr3[5] & 4294967295L) - (iArr[5] & 4294967295L)) - (iArr2[5] & 4294967295L));
iArr3[5] = (int) j6;
long j7 = (j6 >> 32) + (((iArr3[6] & 4294967295L) - (iArr[6] & 4294967295L)) - (iArr2[6] & 4294967295L));
iArr3[6] = (int) j7;
return (int) (j7 >> 32);
}
public static int sub(int[] iArr, int[] iArr2, int[] iArr3) {
long j = (iArr[0] & 4294967295L) - (iArr2[0] & 4294967295L);
iArr3[0] = (int) j;
long j2 = (j >> 32) + ((iArr[1] & 4294967295L) - (iArr2[1] & 4294967295L));
iArr3[1] = (int) j2;
long j3 = (j2 >> 32) + ((iArr[2] & 4294967295L) - (iArr2[2] & 4294967295L));
iArr3[2] = (int) j3;
long j4 = (j3 >> 32) + ((iArr[3] & 4294967295L) - (iArr2[3] & 4294967295L));
iArr3[3] = (int) j4;
long j5 = (j4 >> 32) + ((iArr[4] & 4294967295L) - (iArr2[4] & 4294967295L));
iArr3[4] = (int) j5;
long j6 = (j5 >> 32) + ((iArr[5] & 4294967295L) - (iArr2[5] & 4294967295L));
iArr3[5] = (int) j6;
long j7 = (j6 >> 32) + ((iArr[6] & 4294967295L) - (iArr2[6] & 4294967295L));
iArr3[6] = (int) j7;
return (int) (j7 >> 32);
}
public static int sub(int[] iArr, int i, int[] iArr2, int i2, int[] iArr3, int i3) {
long j = (iArr[i] & 4294967295L) - (iArr2[i2] & 4294967295L);
iArr3[i3] = (int) j;
long j2 = (j >> 32) + ((iArr[i + 1] & 4294967295L) - (iArr2[i2 + 1] & 4294967295L));
iArr3[i3 + 1] = (int) j2;
long j3 = (j2 >> 32) + ((iArr[i + 2] & 4294967295L) - (iArr2[i2 + 2] & 4294967295L));
iArr3[i3 + 2] = (int) j3;
long j4 = (j3 >> 32) + ((iArr[i + 3] & 4294967295L) - (iArr2[i2 + 3] & 4294967295L));
iArr3[i3 + 3] = (int) j4;
long j5 = (j4 >> 32) + ((iArr[i + 4] & 4294967295L) - (iArr2[i2 + 4] & 4294967295L));
iArr3[i3 + 4] = (int) j5;
long j6 = (j5 >> 32) + ((iArr[i + 5] & 4294967295L) - (iArr2[i2 + 5] & 4294967295L));
iArr3[i3 + 5] = (int) j6;
long j7 = (j6 >> 32) + ((iArr[i + 6] & 4294967295L) - (iArr2[i2 + 6] & 4294967295L));
iArr3[i3 + 6] = (int) j7;
return (int) (j7 >> 32);
}
public static void square(int[] iArr, int[] iArr2) {
long j = iArr[0] & 4294967295L;
int i = 14;
int i2 = 0;
int i3 = 6;
while (true) {
int i4 = i3 - 1;
long j2 = iArr[i3] & 4294967295L;
long j3 = j2 * j2;
iArr2[i - 1] = (i2 << 31) | ((int) (j3 >>> 33));
i -= 2;
iArr2[i] = (int) (j3 >>> 1);
i2 = (int) j3;
if (i4 <= 0) {
long j4 = j * j;
iArr2[0] = (int) j4;
int i5 = (int) (j4 >>> 32);
long j5 = iArr[1] & 4294967295L;
long j6 = iArr2[2];
long j7 = ((j4 >>> 33) | ((i2 << 31) & 4294967295L)) + (j5 * j);
int i6 = (int) j7;
iArr2[1] = (i5 & 1) | (i6 << 1);
long j8 = iArr[2] & 4294967295L;
long j9 = iArr2[3];
long j10 = iArr2[4];
long j11 = (j6 & 4294967295L) + (j7 >>> 32) + (j8 * j);
int i7 = (int) j11;
iArr2[2] = (i7 << 1) | (i6 >>> 31);
long j12 = (j9 & 4294967295L) + (j11 >>> 32) + (j8 * j5);
long j13 = iArr[3] & 4294967295L;
long j14 = iArr2[5];
long j15 = iArr2[6];
long j16 = (j12 & 4294967295L) + (j13 * j);
int i8 = (int) j16;
iArr2[3] = (i8 << 1) | (i7 >>> 31);
long j17 = (j10 & 4294967295L) + (j12 >>> 32) + (j16 >>> 32) + (j13 * j5);
long j18 = (j14 & 4294967295L) + (j17 >>> 32) + (j13 * j8);
long j19 = iArr[4] & 4294967295L;
long j20 = iArr2[7];
long j21 = iArr2[8];
long j22 = (j17 & 4294967295L) + (j19 * j);
int i9 = (int) j22;
iArr2[4] = (i9 << 1) | (i8 >>> 31);
long j23 = (j18 & 4294967295L) + (j22 >>> 32) + (j19 * j5);
long j24 = (j15 & 4294967295L) + (j18 >>> 32) + (j23 >>> 32) + (j19 * j8);
long j25 = (j20 & 4294967295L) + (j24 >>> 32) + (j19 * j13);
long j26 = iArr[5] & 4294967295L;
long j27 = iArr2[9];
long j28 = iArr2[10];
long j29 = (j23 & 4294967295L) + (j26 * j);
int i10 = (int) j29;
iArr2[5] = (i10 << 1) | (i9 >>> 31);
long j30 = (j24 & 4294967295L) + (j29 >>> 32) + (j26 * j5);
long j31 = (j25 & 4294967295L) + (j30 >>> 32) + (j26 * j8);
long j32 = (j21 & 4294967295L) + (j25 >>> 32) + (j31 >>> 32) + (j26 * j13);
long j33 = (j27 & 4294967295L) + (j32 >>> 32) + (j26 * j19);
long j34 = iArr[6] & 4294967295L;
long j35 = iArr2[11];
long j36 = iArr2[12];
long j37 = (j30 & 4294967295L) + (j * j34);
int i11 = (int) j37;
iArr2[6] = (i11 << 1) | (i10 >>> 31);
long j38 = (j37 >>> 32) + (j34 * j5) + (j31 & 4294967295L);
long j39 = (j38 >>> 32) + (j8 * j34) + (j32 & 4294967295L);
long j40 = (j39 >>> 32) + (j34 * j13) + (j33 & 4294967295L);
long j41 = (j40 >>> 32) + (j34 * j19) + (j28 & 4294967295L) + (j33 >>> 32);
long j42 = (j35 & 4294967295L) + (j41 >>> 32) + (j34 * j26);
long j43 = (j36 & 4294967295L) + (j42 >>> 32);
int i12 = (int) j38;
iArr2[7] = (i12 << 1) | (i11 >>> 31);
int i13 = (int) j39;
iArr2[8] = (i12 >>> 31) | (i13 << 1);
int i14 = (int) j40;
iArr2[9] = (i13 >>> 31) | (i14 << 1);
int i15 = (int) j41;
iArr2[10] = (i14 >>> 31) | (i15 << 1);
int i16 = (int) j42;
iArr2[11] = (i15 >>> 31) | (i16 << 1);
int i17 = (int) j43;
iArr2[12] = (i16 >>> 31) | (i17 << 1);
iArr2[13] = (i17 >>> 31) | ((iArr2[13] + ((int) (j43 >> 32))) << 1);
return;
}
i3 = i4;
}
}
public static void square(int[] iArr, int i, int[] iArr2, int i2) {
long j = iArr[i] & 4294967295L;
int i3 = 0;
int i4 = 14;
int i5 = 6;
while (true) {
int i6 = i5 - 1;
long j2 = iArr[i + i5] & 4294967295L;
long j3 = j2 * j2;
iArr2[i2 + (i4 - 1)] = (i3 << 31) | ((int) (j3 >>> 33));
i4 -= 2;
iArr2[i2 + i4] = (int) (j3 >>> 1);
i3 = (int) j3;
if (i6 <= 0) {
long j4 = j * j;
iArr2[i2] = (int) j4;
int i7 = (int) (j4 >>> 32);
long j5 = iArr[i + 1] & 4294967295L;
int i8 = i2 + 2;
long j6 = iArr2[i8];
long j7 = (((i3 << 31) & 4294967295L) | (j4 >>> 33)) + (j5 * j);
int i9 = (int) j7;
iArr2[i2 + 1] = (i9 << 1) | (i7 & 1);
long j8 = iArr[i + 2] & 4294967295L;
int i10 = i2 + 3;
long j9 = iArr2[i10];
int i11 = i2 + 4;
long j10 = iArr2[i11];
long j11 = (j6 & 4294967295L) + (j7 >>> 32) + (j8 * j);
int i12 = (int) j11;
iArr2[i8] = (i12 << 1) | (i9 >>> 31);
long j12 = (j9 & 4294967295L) + (j11 >>> 32) + (j8 * j5);
long j13 = iArr[i + 3] & 4294967295L;
int i13 = i2 + 5;
long j14 = iArr2[i13];
int i14 = i2 + 6;
long j15 = iArr2[i14];
long j16 = (j12 & 4294967295L) + (j13 * j);
int i15 = (int) j16;
iArr2[i10] = (i15 << 1) | (i12 >>> 31);
long j17 = (j10 & 4294967295L) + (j12 >>> 32) + (j16 >>> 32) + (j13 * j5);
long j18 = (j14 & 4294967295L) + (j17 >>> 32) + (j13 * j8);
long j19 = iArr[i + 4] & 4294967295L;
int i16 = i2 + 7;
long j20 = iArr2[i16];
int i17 = i2 + 8;
long j21 = iArr2[i17];
long j22 = (j17 & 4294967295L) + (j19 * j);
int i18 = (int) j22;
iArr2[i11] = (i18 << 1) | (i15 >>> 31);
long j23 = (j18 & 4294967295L) + (j22 >>> 32) + (j19 * j5);
long j24 = (j15 & 4294967295L) + (j18 >>> 32) + (j23 >>> 32) + (j19 * j8);
long j25 = (j20 & 4294967295L) + (j24 >>> 32) + (j19 * j13);
long j26 = iArr[i + 5] & 4294967295L;
int i19 = i2 + 9;
long j27 = iArr2[i19];
int i20 = i2 + 10;
long j28 = iArr2[i20];
long j29 = (j23 & 4294967295L) + (j26 * j);
int i21 = (int) j29;
iArr2[i13] = (i18 >>> 31) | (i21 << 1);
long j30 = (j24 & 4294967295L) + (j29 >>> 32) + (j26 * j5);
long j31 = (j25 & 4294967295L) + (j30 >>> 32) + (j26 * j8);
long j32 = (j21 & 4294967295L) + (j25 >>> 32) + (j31 >>> 32) + (j26 * j13);
long j33 = (j27 & 4294967295L) + (j32 >>> 32) + (j26 * j19);
long j34 = iArr[i + 6] & 4294967295L;
int i22 = i2 + 11;
long j35 = iArr2[i22];
int i23 = i2 + 12;
long j36 = iArr2[i23];
long j37 = (j30 & 4294967295L) + (j * j34);
int i24 = (int) j37;
iArr2[i14] = (i24 << 1) | (i21 >>> 31);
long j38 = (j31 & 4294967295L) + (j37 >>> 32) + (j5 * j34);
long j39 = (j32 & 4294967295L) + (j38 >>> 32) + (j34 * j8);
long j40 = (j33 & 4294967295L) + (j39 >>> 32) + (j34 * j13);
long j41 = (j28 & 4294967295L) + (j33 >>> 32) + (j40 >>> 32) + (j34 * j19);
long j42 = (j35 & 4294967295L) + (j41 >>> 32) + (j34 * j26);
long j43 = (j36 & 4294967295L) + (j42 >>> 32);
int i25 = (int) j38;
iArr2[i16] = (i24 >>> 31) | (i25 << 1);
int i26 = (int) j39;
iArr2[i17] = (i25 >>> 31) | (i26 << 1);
int i27 = (int) j40;
iArr2[i19] = (i26 >>> 31) | (i27 << 1);
int i28 = (int) j41;
iArr2[i20] = (i27 >>> 31) | (i28 << 1);
int i29 = (int) j42;
iArr2[i22] = (i28 >>> 31) | (i29 << 1);
int i30 = (int) j43;
iArr2[i23] = (i29 >>> 31) | (i30 << 1);
int i31 = i2 + 13;
iArr2[i31] = (i30 >>> 31) | ((iArr2[i31] + ((int) (j43 >> 32))) << 1);
return;
}
i5 = i6;
}
}
public static int mulWordDwordAdd(int i, long j, int[] iArr, int i2) {
long j2 = i & 4294967295L;
long j3 = ((j & 4294967295L) * j2) + (iArr[i2] & 4294967295L);
iArr[i2] = (int) j3;
long j4 = (j3 >>> 32) + (j2 * (j >>> 32)) + (iArr[r8] & 4294967295L);
iArr[i2 + 1] = (int) j4;
long j5 = (j4 >>> 32) + (iArr[r8] & 4294967295L);
iArr[i2 + 2] = (int) j5;
if ((j5 >>> 32) == 0) {
return 0;
}
return Nat.incAt(7, iArr, i2, 3);
}
public static int mulWordAddTo(int i, int[] iArr, int i2, int[] iArr2, int i3) {
long j = i & 4294967295L;
long j2 = ((iArr[i2] & 4294967295L) * j) + (iArr2[i3] & 4294967295L);
iArr2[i3] = (int) j2;
long j3 = (j2 >>> 32) + ((iArr[i2 + 1] & 4294967295L) * j) + (iArr2[r11] & 4294967295L);
iArr2[i3 + 1] = (int) j3;
long j4 = (j3 >>> 32) + ((iArr[i2 + 2] & 4294967295L) * j) + (iArr2[r11] & 4294967295L);
iArr2[i3 + 2] = (int) j4;
long j5 = (j4 >>> 32) + ((iArr[i2 + 3] & 4294967295L) * j) + (iArr2[r11] & 4294967295L);
iArr2[i3 + 3] = (int) j5;
long j6 = (j5 >>> 32) + ((iArr[i2 + 4] & 4294967295L) * j) + (iArr2[r11] & 4294967295L);
iArr2[i3 + 4] = (int) j6;
long j7 = (j6 >>> 32) + ((iArr[i2 + 5] & 4294967295L) * j) + (iArr2[r11] & 4294967295L);
iArr2[i3 + 5] = (int) j7;
long j8 = (j7 >>> 32) + (j * (iArr[i2 + 6] & 4294967295L)) + (iArr2[r15] & 4294967295L);
iArr2[i3 + 6] = (int) j8;
return (int) (j8 >>> 32);
}
public static int mulWord(int i, int[] iArr, int[] iArr2, int i2) {
long j = i;
long j2 = 0;
int i3 = 0;
do {
long j3 = j2 + ((iArr[i3] & 4294967295L) * (4294967295L & j));
iArr2[i2 + i3] = (int) j3;
j2 = j3 >>> 32;
i3++;
} while (i3 < 7);
return (int) j2;
}
public static int mulByWordAddTo(int i, int[] iArr, int[] iArr2) {
long j = i & 4294967295L;
long j2 = ((iArr2[0] & 4294967295L) * j) + (iArr[0] & 4294967295L);
iArr2[0] = (int) j2;
long j3 = (j2 >>> 32) + ((iArr2[1] & 4294967295L) * j) + (iArr[1] & 4294967295L);
iArr2[1] = (int) j3;
long j4 = (j3 >>> 32) + ((iArr2[2] & 4294967295L) * j) + (iArr[2] & 4294967295L);
iArr2[2] = (int) j4;
long j5 = (j4 >>> 32) + ((iArr2[3] & 4294967295L) * j) + (iArr[3] & 4294967295L);
iArr2[3] = (int) j5;
long j6 = (j5 >>> 32) + ((iArr2[4] & 4294967295L) * j) + (iArr[4] & 4294967295L);
iArr2[4] = (int) j6;
long j7 = (j6 >>> 32) + ((iArr2[5] & 4294967295L) * j) + (iArr[5] & 4294967295L);
iArr2[5] = (int) j7;
long j8 = (j7 >>> 32) + (j * (iArr2[6] & 4294967295L)) + (4294967295L & iArr[6]);
iArr2[6] = (int) j8;
return (int) (j8 >>> 32);
}
public static int mulByWord(int i, int[] iArr) {
long j = i & 4294967295L;
long j2 = (iArr[0] & 4294967295L) * j;
iArr[0] = (int) j2;
long j3 = (j2 >>> 32) + ((iArr[1] & 4294967295L) * j);
iArr[1] = (int) j3;
long j4 = (j3 >>> 32) + ((iArr[2] & 4294967295L) * j);
iArr[2] = (int) j4;
long j5 = (j4 >>> 32) + ((iArr[3] & 4294967295L) * j);
iArr[3] = (int) j5;
long j6 = (j5 >>> 32) + ((iArr[4] & 4294967295L) * j);
iArr[4] = (int) j6;
long j7 = (j6 >>> 32) + ((iArr[5] & 4294967295L) * j);
iArr[5] = (int) j7;
long j8 = (j7 >>> 32) + (j * (4294967295L & iArr[6]));
iArr[6] = (int) j8;
return (int) (j8 >>> 32);
}
public static int mulAddTo(int[] iArr, int[] iArr2, int[] iArr3) {
long j = iArr2[0];
long j2 = iArr2[1] & 4294967295L;
long j3 = iArr2[2];
long j4 = iArr2[3];
long j5 = iArr2[4];
long j6 = iArr2[5] & 4294967295L;
long j7 = iArr2[6] & 4294967295L;
long j8 = 0;
int i = 0;
while (i < 7) {
long j9 = j7;
long j10 = iArr[i] & 4294967295L;
long j11 = j6;
long j12 = (iArr3[i] & 4294967295L) + ((j & 4294967295L) * j10);
iArr3[i] = (int) j12;
int i2 = i + 1;
long j13 = j2;
long j14 = (j12 >>> 32) + (j10 * j2) + (iArr3[i2] & 4294967295L);
iArr3[i2] = (int) j14;
long j15 = j3;
long j16 = (j14 >>> 32) + ((j3 & 4294967295L) * j10) + (iArr3[r3] & 4294967295L);
iArr3[i + 2] = (int) j16;
long j17 = (j16 >>> 32) + ((j4 & 4294967295L) * j10) + (iArr3[r3] & 4294967295L);
iArr3[i + 3] = (int) j17;
long j18 = (j17 >>> 32) + ((j5 & 4294967295L) * j10) + (iArr3[r3] & 4294967295L);
iArr3[i + 4] = (int) j18;
long j19 = (j18 >>> 32) + (j10 * j11) + (iArr3[r3] & 4294967295L);
iArr3[i + 5] = (int) j19;
long j20 = (j19 >>> 32) + (j10 * j9) + (iArr3[r3] & 4294967295L);
iArr3[i + 6] = (int) j20;
long j21 = (j20 >>> 32) + j8 + (iArr3[r2] & 4294967295L);
iArr3[i + 7] = (int) j21;
j8 = j21 >>> 32;
i = i2;
j7 = j9;
j6 = j11;
j4 = j4;
j2 = j13;
j3 = j15;
}
return (int) j8;
}
public static int mulAddTo(int[] iArr, int i, int[] iArr2, int i2, int[] iArr3, int i3) {
long j = iArr2[i2] & 4294967295L;
long j2 = iArr2[i2 + 1] & 4294967295L;
long j3 = iArr2[i2 + 2] & 4294967295L;
long j4 = iArr2[i2 + 3];
long j5 = iArr2[i2 + 4];
long j6 = iArr2[i2 + 5];
long j7 = iArr2[i2 + 6] & 4294967295L;
long j8 = 0;
int i4 = 0;
int i5 = i3;
while (i4 < 7) {
int i6 = i4;
long j9 = iArr[i + i4] & 4294967295L;
long j10 = j;
long j11 = (j9 * j) + (iArr3[i5] & 4294967295L);
long j12 = j7;
iArr3[i5] = (int) j11;
int i7 = i5 + 1;
long j13 = j2;
long j14 = (j11 >>> 32) + (j9 * j2) + (iArr3[i7] & 4294967295L);
iArr3[i7] = (int) j14;
long j15 = (j14 >>> 32) + (j9 * j3) + (iArr3[r4] & 4294967295L);
iArr3[i5 + 2] = (int) j15;
long j16 = (j15 >>> 32) + ((j4 & 4294967295L) * j9) + (iArr3[r4] & 4294967295L);
iArr3[i5 + 3] = (int) j16;
long j17 = (j16 >>> 32) + ((j5 & 4294967295L) * j9) + (iArr3[r4] & 4294967295L);
iArr3[i5 + 4] = (int) j17;
long j18 = (j17 >>> 32) + ((j6 & 4294967295L) * j9) + (iArr3[r4] & 4294967295L);
iArr3[i5 + 5] = (int) j18;
long j19 = (j18 >>> 32) + (j9 * j12) + (iArr3[r4] & 4294967295L);
iArr3[i5 + 6] = (int) j19;
long j20 = (j19 >>> 32) + j8 + (iArr3[r16] & 4294967295L);
iArr3[i5 + 7] = (int) j20;
j8 = j20 >>> 32;
i4 = i6 + 1;
i5 = i7;
j7 = j12;
j = j10;
j4 = j4;
j2 = j13;
j3 = j3;
}
return (int) j8;
}
public static int mul33WordAdd(int i, int i2, int[] iArr, int i3) {
long j = i;
long j2 = i2 & 4294967295L;
long j3 = ((j & 4294967295L) * j2) + (iArr[i3] & 4294967295L);
iArr[i3] = (int) j3;
long j4 = (j3 >>> 32) + j2 + (iArr[r4] & 4294967295L);
iArr[i3 + 1] = (int) j4;
long j5 = (j4 >>> 32) + (4294967295L & iArr[r8]);
iArr[i3 + 2] = (int) j5;
if ((j5 >>> 32) == 0) {
return 0;
}
return Nat.incAt(7, iArr, i3, 3);
}
public static int mul33DWordAdd(int i, long j, int[] iArr, int i2) {
long j2 = i & 4294967295L;
long j3 = j & 4294967295L;
long j4 = (j2 * j3) + (iArr[i2] & 4294967295L);
iArr[i2] = (int) j4;
long j5 = j >>> 32;
long j6 = (j4 >>> 32) + (j2 * j5) + j3 + (iArr[r8] & 4294967295L);
iArr[i2 + 1] = (int) j6;
long j7 = (j6 >>> 32) + j5 + (iArr[r0] & 4294967295L);
iArr[i2 + 2] = (int) j7;
long j8 = (j7 >>> 32) + (4294967295L & iArr[r11]);
iArr[i2 + 3] = (int) j8;
if ((j8 >>> 32) == 0) {
return 0;
}
return Nat.incAt(7, iArr, i2, 4);
}
public static long mul33Add(int i, int[] iArr, int i2, int[] iArr2, int i3, int[] iArr3, int i4) {
long j = i & 4294967295L;
long j2 = iArr[i2] & 4294967295L;
long j3 = (j * j2) + (iArr2[i3] & 4294967295L);
iArr3[i4] = (int) j3;
long j4 = iArr[i2 + 1] & 4294967295L;
long j5 = (j3 >>> 32) + (j * j4) + j2 + (iArr2[i3 + 1] & 4294967295L);
iArr3[i4 + 1] = (int) j5;
long j6 = iArr[i2 + 2] & 4294967295L;
long j7 = (j5 >>> 32) + (j * j6) + j4 + (iArr2[i3 + 2] & 4294967295L);
iArr3[i4 + 2] = (int) j7;
long j8 = iArr[i2 + 3] & 4294967295L;
long j9 = (j7 >>> 32) + (j * j8) + j6 + (iArr2[i3 + 3] & 4294967295L);
iArr3[i4 + 3] = (int) j9;
long j10 = iArr[i2 + 4] & 4294967295L;
long j11 = (j9 >>> 32) + (j * j10) + j8 + (iArr2[i3 + 4] & 4294967295L);
iArr3[i4 + 4] = (int) j11;
long j12 = iArr[i2 + 5] & 4294967295L;
long j13 = (j11 >>> 32) + (j * j12) + j10 + (iArr2[i3 + 5] & 4294967295L);
iArr3[i4 + 5] = (int) j13;
long j14 = iArr[i2 + 6] & 4294967295L;
long j15 = (j13 >>> 32) + (j * j14) + j12 + (4294967295L & iArr2[i3 + 6]);
iArr3[i4 + 6] = (int) j15;
return (j15 >>> 32) + j14;
}
public static void mul(int[] iArr, int[] iArr2, int[] iArr3) {
long j = iArr2[0] & 4294967295L;
long j2 = iArr2[1] & 4294967295L;
long j3 = iArr2[2] & 4294967295L;
long j4 = iArr2[3] & 4294967295L;
long j5 = iArr2[4] & 4294967295L;
long j6 = iArr2[5] & 4294967295L;
long j7 = iArr2[6] & 4294967295L;
long j8 = iArr[0] & 4294967295L;
long j9 = j8 * j;
iArr3[0] = (int) j9;
long j10 = (j9 >>> 32) + (j8 * j2);
iArr3[1] = (int) j10;
long j11 = (j10 >>> 32) + (j8 * j3);
iArr3[2] = (int) j11;
long j12 = (j11 >>> 32) + (j8 * j4);
iArr3[3] = (int) j12;
long j13 = (j12 >>> 32) + (j8 * j5);
iArr3[4] = (int) j13;
long j14 = (j13 >>> 32) + (j8 * j6);
iArr3[5] = (int) j14;
long j15 = (j14 >>> 32) + (j8 * j7);
iArr3[6] = (int) j15;
iArr3[7] = (int) (j15 >>> 32);
int i = 1;
for (int i2 = 7; i < i2; i2 = 7) {
long j16 = iArr[i] & 4294967295L;
long j17 = (j16 * j) + (iArr3[i] & 4294967295L);
iArr3[i] = (int) j17;
int i3 = i + 1;
long j18 = (j17 >>> 32) + (j16 * j2) + (iArr3[i3] & 4294967295L);
iArr3[i3] = (int) j18;
long j19 = (j18 >>> 32) + (j16 * j3) + (iArr3[r3] & 4294967295L);
iArr3[i + 2] = (int) j19;
long j20 = (j19 >>> 32) + (j16 * j4) + (iArr3[r3] & 4294967295L);
iArr3[i + 3] = (int) j20;
long j21 = (j20 >>> 32) + (j16 * j5) + (iArr3[r3] & 4294967295L);
iArr3[i + 4] = (int) j21;
long j22 = (j21 >>> 32) + (j16 * j6) + (iArr3[r3] & 4294967295L);
iArr3[i + 5] = (int) j22;
long j23 = (j22 >>> 32) + (j16 * j7) + (iArr3[r3] & 4294967295L);
iArr3[i + 6] = (int) j23;
iArr3[i + 7] = (int) (j23 >>> 32);
i = i3;
j4 = j4;
j = j;
j2 = j2;
}
}
public static void mul(int[] iArr, int i, int[] iArr2, int i2, int[] iArr3, int i3) {
long j = iArr2[i2] & 4294967295L;
long j2 = iArr2[i2 + 1] & 4294967295L;
long j3 = iArr2[i2 + 2] & 4294967295L;
long j4 = iArr2[i2 + 3] & 4294967295L;
long j5 = iArr2[i2 + 4] & 4294967295L;
long j6 = iArr2[i2 + 5] & 4294967295L;
long j7 = iArr2[i2 + 6];
long j8 = iArr[i] & 4294967295L;
long j9 = j8 * j;
iArr3[i3] = (int) j9;
long j10 = (j9 >>> 32) + (j8 * j2);
iArr3[i3 + 1] = (int) j10;
long j11 = (j10 >>> 32) + (j8 * j3);
iArr3[i3 + 2] = (int) j11;
long j12 = (j11 >>> 32) + (j8 * j4);
iArr3[i3 + 3] = (int) j12;
long j13 = (j12 >>> 32) + (j8 * j5);
iArr3[i3 + 4] = (int) j13;
long j14 = (j13 >>> 32) + (j8 * j6);
iArr3[i3 + 5] = (int) j14;
long j15 = j7 & 4294967295L;
long j16 = (j14 >>> 32) + (j8 * j15);
iArr3[i3 + 6] = (int) j16;
iArr3[i3 + 7] = (int) (j16 >>> 32);
int i4 = 1;
int i5 = i3;
while (i4 < 7) {
int i6 = i5 + 1;
long j17 = iArr[i + i4] & 4294967295L;
long j18 = j15;
int i7 = i4;
long j19 = (j17 * j) + (iArr3[i6] & 4294967295L);
iArr3[i6] = (int) j19;
long j20 = (j19 >>> 32) + (j17 * j2) + (iArr3[r0] & 4294967295L);
iArr3[i5 + 2] = (int) j20;
long j21 = (j20 >>> 32) + (j17 * j3) + (iArr3[r0] & 4294967295L);
iArr3[i5 + 3] = (int) j21;
long j22 = (j21 >>> 32) + (j17 * j4) + (iArr3[r0] & 4294967295L);
iArr3[i5 + 4] = (int) j22;
long j23 = (j22 >>> 32) + (j17 * j5) + (iArr3[r0] & 4294967295L);
iArr3[i5 + 5] = (int) j23;
long j24 = (j23 >>> 32) + (j17 * j6) + (iArr3[r0] & 4294967295L);
iArr3[i5 + 6] = (int) j24;
long j25 = (j24 >>> 32) + (j17 * j18) + (iArr3[r0] & 4294967295L);
iArr3[i5 + 7] = (int) j25;
iArr3[i5 + 8] = (int) (j25 >>> 32);
i4 = i7 + 1;
i5 = i6;
j15 = j18;
j3 = j3;
}
}
public static boolean isZero(int[] iArr) {
for (int i = 0; i < 7; i++) {
if (iArr[i] != 0) {
return false;
}
}
return true;
}
public static boolean isOne(int[] iArr) {
if (iArr[0] != 1) {
return false;
}
for (int i = 1; i < 7; i++) {
if (iArr[i] != 0) {
return false;
}
}
return true;
}
public static boolean gte(int[] iArr, int[] iArr2) {
for (int i = 6; i >= 0; i--) {
int i2 = iArr[i] ^ PKIFailureInfo.systemUnavail;
int i3 = Integer.MIN_VALUE ^ iArr2[i];
if (i2 < i3) {
return false;
}
if (i2 > i3) {
return true;
}
}
return true;
}
public static boolean gte(int[] iArr, int i, int[] iArr2, int i2) {
for (int i3 = 6; i3 >= 0; i3--) {
int i4 = iArr[i + i3] ^ PKIFailureInfo.systemUnavail;
int i5 = Integer.MIN_VALUE ^ iArr2[i2 + i3];
if (i4 < i5) {
return false;
}
if (i4 > i5) {
return true;
}
}
return true;
}
public static int getBit(int[] iArr, int i) {
int i2;
if (i == 0) {
i2 = iArr[0];
} else {
int i3 = i >> 5;
if (i3 < 0 || i3 >= 7) {
return 0;
}
i2 = iArr[i3] >>> (i & 31);
}
return i2 & 1;
}
public static int[] fromBigInteger(BigInteger bigInteger) {
if (bigInteger.signum() < 0 || bigInteger.bitLength() > 224) {
throw new IllegalArgumentException();
}
int[] create = create();
int i = 0;
while (bigInteger.signum() != 0) {
create[i] = bigInteger.intValue();
bigInteger = bigInteger.shiftRight(32);
i++;
}
return create;
}
public static boolean eq(int[] iArr, int[] iArr2) {
for (int i = 6; i >= 0; i--) {
if (iArr[i] != iArr2[i]) {
return false;
}
}
return true;
}
public static boolean diff(int[] iArr, int i, int[] iArr2, int i2, int[] iArr3, int i3) {
boolean gte = gte(iArr, i, iArr2, i2);
if (gte) {
sub(iArr, i, iArr2, i2, iArr3, i3);
} else {
sub(iArr2, i2, iArr, i, iArr3, i3);
}
return gte;
}
public static int[] createExt() {
return new int[14];
}
public static int[] create() {
return new int[7];
}
public static void copy(int[] iArr, int[] iArr2) {
iArr2[0] = iArr[0];
iArr2[1] = iArr[1];
iArr2[2] = iArr[2];
iArr2[3] = iArr[3];
iArr2[4] = iArr[4];
iArr2[5] = iArr[5];
iArr2[6] = iArr[6];
}
public static int addToEachOther(int[] iArr, int i, int[] iArr2, int i2) {
long j = (iArr[i] & 4294967295L) + (iArr2[i2] & 4294967295L);
int i3 = (int) j;
iArr[i] = i3;
iArr2[i2] = i3;
long j2 = (j >>> 32) + (iArr[r4] & 4294967295L) + (iArr2[r7] & 4294967295L);
int i4 = (int) j2;
iArr[i + 1] = i4;
iArr2[i2 + 1] = i4;
long j3 = (j2 >>> 32) + (iArr[r4] & 4294967295L) + (iArr2[r7] & 4294967295L);
int i5 = (int) j3;
iArr[i + 2] = i5;
iArr2[i2 + 2] = i5;
long j4 = (j3 >>> 32) + (iArr[r4] & 4294967295L) + (iArr2[r7] & 4294967295L);
int i6 = (int) j4;
iArr[i + 3] = i6;
iArr2[i2 + 3] = i6;
long j5 = (j4 >>> 32) + (iArr[r4] & 4294967295L) + (iArr2[r7] & 4294967295L);
int i7 = (int) j5;
iArr[i + 4] = i7;
iArr2[i2 + 4] = i7;
long j6 = (j5 >>> 32) + (iArr[r4] & 4294967295L) + (iArr2[r7] & 4294967295L);
int i8 = (int) j6;
iArr[i + 5] = i8;
iArr2[i2 + 5] = i8;
long j7 = (j6 >>> 32) + (iArr[r12] & 4294967295L) + (4294967295L & iArr2[r14]);
int i9 = (int) j7;
iArr[i + 6] = i9;
iArr2[i2 + 6] = i9;
return (int) (j7 >>> 32);
}
public static int addTo(int[] iArr, int[] iArr2) {
long j = (iArr[0] & 4294967295L) + (iArr2[0] & 4294967295L);
iArr2[0] = (int) j;
long j2 = (j >>> 32) + (iArr[1] & 4294967295L) + (iArr2[1] & 4294967295L);
iArr2[1] = (int) j2;
long j3 = (j2 >>> 32) + (iArr[2] & 4294967295L) + (iArr2[2] & 4294967295L);
iArr2[2] = (int) j3;
long j4 = (j3 >>> 32) + (iArr[3] & 4294967295L) + (iArr2[3] & 4294967295L);
iArr2[3] = (int) j4;
long j5 = (j4 >>> 32) + (iArr[4] & 4294967295L) + (iArr2[4] & 4294967295L);
iArr2[4] = (int) j5;
long j6 = (j5 >>> 32) + (iArr[5] & 4294967295L) + (iArr2[5] & 4294967295L);
iArr2[5] = (int) j6;
long j7 = (j6 >>> 32) + (iArr[6] & 4294967295L) + (4294967295L & iArr2[6]);
iArr2[6] = (int) j7;
return (int) (j7 >>> 32);
}
public static int addTo(int[] iArr, int i, int[] iArr2, int i2, int i3) {
long j = (i3 & 4294967295L) + (iArr[i] & 4294967295L) + (iArr2[i2] & 4294967295L);
iArr2[i2] = (int) j;
long j2 = (j >>> 32) + (iArr[i + 1] & 4294967295L) + (iArr2[r13] & 4294967295L);
iArr2[i2 + 1] = (int) j2;
long j3 = (j2 >>> 32) + (iArr[i + 2] & 4294967295L) + (iArr2[r13] & 4294967295L);
iArr2[i2 + 2] = (int) j3;
long j4 = (j3 >>> 32) + (iArr[i + 3] & 4294967295L) + (iArr2[r13] & 4294967295L);
iArr2[i2 + 3] = (int) j4;
long j5 = (j4 >>> 32) + (iArr[i + 4] & 4294967295L) + (iArr2[r13] & 4294967295L);
iArr2[i2 + 4] = (int) j5;
long j6 = (j5 >>> 32) + (iArr[i + 5] & 4294967295L) + (iArr2[r13] & 4294967295L);
iArr2[i2 + 5] = (int) j6;
long j7 = (j6 >>> 32) + (iArr[i + 6] & 4294967295L) + (4294967295L & iArr2[r12]);
iArr2[i2 + 6] = (int) j7;
return (int) (j7 >>> 32);
}
public static int addBothTo(int[] iArr, int[] iArr2, int[] iArr3) {
long j = (iArr[0] & 4294967295L) + (iArr2[0] & 4294967295L) + (iArr3[0] & 4294967295L);
iArr3[0] = (int) j;
long j2 = (j >>> 32) + (iArr[1] & 4294967295L) + (iArr2[1] & 4294967295L) + (iArr3[1] & 4294967295L);
iArr3[1] = (int) j2;
long j3 = (j2 >>> 32) + (iArr[2] & 4294967295L) + (iArr2[2] & 4294967295L) + (iArr3[2] & 4294967295L);
iArr3[2] = (int) j3;
long j4 = (j3 >>> 32) + (iArr[3] & 4294967295L) + (iArr2[3] & 4294967295L) + (iArr3[3] & 4294967295L);
iArr3[3] = (int) j4;
long j5 = (j4 >>> 32) + (iArr[4] & 4294967295L) + (iArr2[4] & 4294967295L) + (iArr3[4] & 4294967295L);
iArr3[4] = (int) j5;
long j6 = (j5 >>> 32) + (iArr[5] & 4294967295L) + (iArr2[5] & 4294967295L) + (iArr3[5] & 4294967295L);
iArr3[5] = (int) j6;
long j7 = (j6 >>> 32) + (iArr[6] & 4294967295L) + (iArr2[6] & 4294967295L) + (iArr3[6] & 4294967295L);
iArr3[6] = (int) j7;
return (int) (j7 >>> 32);
}
public static int addBothTo(int[] iArr, int i, int[] iArr2, int i2, int[] iArr3, int i3) {
long j = (iArr[i] & 4294967295L) + (iArr2[i2] & 4294967295L) + (iArr3[i3] & 4294967295L);
iArr3[i3] = (int) j;
long j2 = (j >>> 32) + (iArr[i + 1] & 4294967295L) + (iArr2[i2 + 1] & 4294967295L) + (iArr3[r8] & 4294967295L);
iArr3[i3 + 1] = (int) j2;
long j3 = (j2 >>> 32) + (iArr[i + 2] & 4294967295L) + (iArr2[i2 + 2] & 4294967295L) + (iArr3[r8] & 4294967295L);
iArr3[i3 + 2] = (int) j3;
long j4 = (j3 >>> 32) + (iArr[i + 3] & 4294967295L) + (iArr2[i2 + 3] & 4294967295L) + (iArr3[r8] & 4294967295L);
iArr3[i3 + 3] = (int) j4;
long j5 = (j4 >>> 32) + (iArr[i + 4] & 4294967295L) + (iArr2[i2 + 4] & 4294967295L) + (iArr3[r8] & 4294967295L);
iArr3[i3 + 4] = (int) j5;
long j6 = (j5 >>> 32) + (iArr[i + 5] & 4294967295L) + (iArr2[i2 + 5] & 4294967295L) + (iArr3[r8] & 4294967295L);
iArr3[i3 + 5] = (int) j6;
long j7 = (j6 >>> 32) + (iArr[i + 6] & 4294967295L) + (iArr2[i2 + 6] & 4294967295L) + (iArr3[r15] & 4294967295L);
iArr3[i3 + 6] = (int) j7;
return (int) (j7 >>> 32);
}
public static int add(int[] iArr, int[] iArr2, int[] iArr3) {
long j = (iArr[0] & 4294967295L) + (iArr2[0] & 4294967295L);
iArr3[0] = (int) j;
long j2 = (j >>> 32) + (iArr[1] & 4294967295L) + (iArr2[1] & 4294967295L);
iArr3[1] = (int) j2;
long j3 = (j2 >>> 32) + (iArr[2] & 4294967295L) + (iArr2[2] & 4294967295L);
iArr3[2] = (int) j3;
long j4 = (j3 >>> 32) + (iArr[3] & 4294967295L) + (iArr2[3] & 4294967295L);
iArr3[3] = (int) j4;
long j5 = (j4 >>> 32) + (iArr[4] & 4294967295L) + (iArr2[4] & 4294967295L);
iArr3[4] = (int) j5;
long j6 = (j5 >>> 32) + (iArr[5] & 4294967295L) + (iArr2[5] & 4294967295L);
iArr3[5] = (int) j6;
long j7 = (j6 >>> 32) + (iArr[6] & 4294967295L) + (iArr2[6] & 4294967295L);
iArr3[6] = (int) j7;
return (int) (j7 >>> 32);
}
public static int add(int[] iArr, int i, int[] iArr2, int i2, int[] iArr3, int i3) {
long j = (iArr[i] & 4294967295L) + (iArr2[i2] & 4294967295L);
iArr3[i3] = (int) j;
long j2 = (j >>> 32) + (iArr[i + 1] & 4294967295L) + (iArr2[i2 + 1] & 4294967295L);
iArr3[i3 + 1] = (int) j2;
long j3 = (j2 >>> 32) + (iArr[i + 2] & 4294967295L) + (iArr2[i2 + 2] & 4294967295L);
iArr3[i3 + 2] = (int) j3;
long j4 = (j3 >>> 32) + (iArr[i + 3] & 4294967295L) + (iArr2[i2 + 3] & 4294967295L);
iArr3[i3 + 3] = (int) j4;
long j5 = (j4 >>> 32) + (iArr[i + 4] & 4294967295L) + (iArr2[i2 + 4] & 4294967295L);
iArr3[i3 + 4] = (int) j5;
long j6 = (j5 >>> 32) + (iArr[i + 5] & 4294967295L) + (iArr2[i2 + 5] & 4294967295L);
iArr3[i3 + 5] = (int) j6;
long j7 = (j6 >>> 32) + (iArr[i + 6] & 4294967295L) + (iArr2[i2 + 6] & 4294967295L);
iArr3[i3 + 6] = (int) j7;
return (int) (j7 >>> 32);
}
}