what-the-bank/sources/o/vil.java

56 lines
2.0 KiB
Java

package o;
import java.nio.ByteBuffer;
import java.security.GeneralSecurityException;
/* loaded from: classes2.dex */
public final class vil {
public static final boolean d(byte[] bArr, byte[] bArr2) {
if (bArr == null || bArr2 == null || bArr.length != bArr2.length) {
return false;
}
int i = 0;
for (int i2 = 0; i2 < bArr.length; i2++) {
i |= bArr[i2] ^ bArr2[i2];
}
return i == 0;
}
public static byte[] a(byte[]... bArr) throws GeneralSecurityException {
int i = 0;
for (byte[] bArr2 : bArr) {
if (i > Integer.MAX_VALUE - bArr2.length) {
throw new GeneralSecurityException("exceeded size limit");
}
i += bArr2.length;
}
byte[] bArr3 = new byte[i];
int i2 = 0;
for (byte[] bArr4 : bArr) {
System.arraycopy(bArr4, 0, bArr3, i2, bArr4.length);
i2 += bArr4.length;
}
return bArr3;
}
public static final byte[] c(byte[] bArr, int i, byte[] bArr2, int i2, int i3) {
if (i3 < 0 || bArr.length - i3 < i || bArr2.length - i3 < i2) {
throw new IllegalArgumentException("That combination of buffers, offsets and length to xor result in out-of-bond accesses.");
}
byte[] bArr3 = new byte[i3];
for (int i4 = 0; i4 < i3; i4++) {
bArr3[i4] = (byte) (bArr[i4 + i] ^ bArr2[i4 + i2]);
}
return bArr3;
}
public static final void a(ByteBuffer byteBuffer, ByteBuffer byteBuffer2, ByteBuffer byteBuffer3, int i) {
if (i < 0 || byteBuffer2.remaining() < i || byteBuffer3.remaining() < i || byteBuffer.remaining() < i) {
throw new IllegalArgumentException("That combination of buffers, offsets and length to xor result in out-of-bond accesses.");
}
for (int i2 = 0; i2 < i; i2++) {
byteBuffer.put((byte) (byteBuffer2.get() ^ byteBuffer3.get()));
}
}
}