83 lines
2.1 KiB
Java
83 lines
2.1 KiB
Java
|
package org.bouncycastle.math.raw;
|
||
|
|
||
|
import java.math.BigInteger;
|
||
|
import org.bouncycastle.util.Pack;
|
||
|
|
||
|
/* loaded from: classes6.dex */
|
||
|
public abstract class Nat576 {
|
||
|
public static BigInteger toBigInteger64(long[] jArr) {
|
||
|
byte[] bArr = new byte[72];
|
||
|
for (int i = 0; i < 9; i++) {
|
||
|
long j = jArr[i];
|
||
|
if (j != 0) {
|
||
|
Pack.longToBigEndian(j, bArr, (8 - i) << 3);
|
||
|
}
|
||
|
}
|
||
|
return new BigInteger(1, bArr);
|
||
|
}
|
||
|
|
||
|
public static boolean isZero64(long[] jArr) {
|
||
|
for (int i = 0; i < 9; i++) {
|
||
|
if (jArr[i] != 0) {
|
||
|
return false;
|
||
|
}
|
||
|
}
|
||
|
return true;
|
||
|
}
|
||
|
|
||
|
public static boolean isOne64(long[] jArr) {
|
||
|
if (jArr[0] != 1) {
|
||
|
return false;
|
||
|
}
|
||
|
for (int i = 1; i < 9; i++) {
|
||
|
if (jArr[i] != 0) {
|
||
|
return false;
|
||
|
}
|
||
|
}
|
||
|
return true;
|
||
|
}
|
||
|
|
||
|
public static long[] fromBigInteger64(BigInteger bigInteger) {
|
||
|
if (bigInteger.signum() < 0 || bigInteger.bitLength() > 576) {
|
||
|
throw new IllegalArgumentException();
|
||
|
}
|
||
|
long[] create64 = create64();
|
||
|
int i = 0;
|
||
|
while (bigInteger.signum() != 0) {
|
||
|
create64[i] = bigInteger.longValue();
|
||
|
bigInteger = bigInteger.shiftRight(64);
|
||
|
i++;
|
||
|
}
|
||
|
return create64;
|
||
|
}
|
||
|
|
||
|
public static boolean eq64(long[] jArr, long[] jArr2) {
|
||
|
for (int i = 8; i >= 0; i--) {
|
||
|
if (jArr[i] != jArr2[i]) {
|
||
|
return false;
|
||
|
}
|
||
|
}
|
||
|
return true;
|
||
|
}
|
||
|
|
||
|
public static long[] createExt64() {
|
||
|
return new long[18];
|
||
|
}
|
||
|
|
||
|
public static long[] create64() {
|
||
|
return new long[9];
|
||
|
}
|
||
|
|
||
|
public static void copy64(long[] jArr, long[] jArr2) {
|
||
|
jArr2[0] = jArr[0];
|
||
|
jArr2[1] = jArr[1];
|
||
|
jArr2[2] = jArr[2];
|
||
|
jArr2[3] = jArr[3];
|
||
|
jArr2[4] = jArr[4];
|
||
|
jArr2[5] = jArr[5];
|
||
|
jArr2[6] = jArr[6];
|
||
|
jArr2[7] = jArr[7];
|
||
|
jArr2[8] = jArr[8];
|
||
|
}
|
||
|
}
|