68 lines
2.4 KiB
Java
68 lines
2.4 KiB
Java
|
package com.google.android.gms.internal.p002firebaseauthapi;
|
||
|
|
||
|
import java.nio.ByteBuffer;
|
||
|
import java.security.GeneralSecurityException;
|
||
|
|
||
|
/* loaded from: classes2.dex */
|
||
|
public final class zzpp {
|
||
|
public static final void zza(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()));
|
||
|
}
|
||
|
}
|
||
|
|
||
|
public static final boolean zzb(byte[] bArr, byte[] bArr2) {
|
||
|
if (bArr != null && bArr2 != null && bArr.length == bArr2.length) {
|
||
|
int i = 0;
|
||
|
for (int i2 = 0; i2 < bArr.length; i2++) {
|
||
|
i |= bArr[i2] ^ bArr2[i2];
|
||
|
}
|
||
|
if (i == 0) {
|
||
|
return true;
|
||
|
}
|
||
|
}
|
||
|
return false;
|
||
|
}
|
||
|
|
||
|
public static byte[] zzc(byte[]... bArr) throws GeneralSecurityException {
|
||
|
int i = 0;
|
||
|
for (byte[] bArr2 : bArr) {
|
||
|
int length = bArr2.length;
|
||
|
if (i > Integer.MAX_VALUE - length) {
|
||
|
throw new GeneralSecurityException("exceeded size limit");
|
||
|
}
|
||
|
i += length;
|
||
|
}
|
||
|
byte[] bArr3 = new byte[i];
|
||
|
int i2 = 0;
|
||
|
for (byte[] bArr4 : bArr) {
|
||
|
int length2 = bArr4.length;
|
||
|
System.arraycopy(bArr4, 0, bArr3, i2, length2);
|
||
|
i2 += length2;
|
||
|
}
|
||
|
return bArr3;
|
||
|
}
|
||
|
|
||
|
public static final byte[] zzd(byte[] bArr, byte[] bArr2) {
|
||
|
int length = bArr.length;
|
||
|
if (length != bArr2.length) {
|
||
|
throw new IllegalArgumentException("The lengths of x and y should match.");
|
||
|
}
|
||
|
return zze(bArr, 0, bArr2, 0, length);
|
||
|
}
|
||
|
|
||
|
public static final byte[] zze(byte[] bArr, int i, byte[] bArr2, int i2, int i3) {
|
||
|
if (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;
|
||
|
}
|
||
|
}
|