70 lines
2.4 KiB
Java
70 lines
2.4 KiB
Java
|
package o;
|
||
|
|
||
|
import java.nio.ByteBuffer;
|
||
|
import java.nio.ByteOrder;
|
||
|
import java.security.GeneralSecurityException;
|
||
|
import java.security.InvalidKeyException;
|
||
|
|
||
|
/* renamed from: o.bsJ, reason: case insensitive filesystem */
|
||
|
/* loaded from: classes2.dex */
|
||
|
abstract class AbstractC5396bsJ {
|
||
|
int[] c;
|
||
|
private final int e;
|
||
|
|
||
|
abstract int b();
|
||
|
|
||
|
abstract int[] e(int[] iArr, int i);
|
||
|
|
||
|
public AbstractC5396bsJ(byte[] bArr, int i) throws InvalidKeyException {
|
||
|
if (bArr.length != 32) {
|
||
|
throw new InvalidKeyException("The key length in bytes must be 32.");
|
||
|
}
|
||
|
this.c = C11262eby.d(bArr);
|
||
|
this.e = i;
|
||
|
}
|
||
|
|
||
|
public void e(ByteBuffer byteBuffer, byte[] bArr, byte[] bArr2) throws GeneralSecurityException {
|
||
|
if (byteBuffer.remaining() < bArr2.length) {
|
||
|
throw new IllegalArgumentException("Given ByteBuffer output is too small");
|
||
|
}
|
||
|
c(bArr, byteBuffer, ByteBuffer.wrap(bArr2));
|
||
|
}
|
||
|
|
||
|
public byte[] c(byte[] bArr, ByteBuffer byteBuffer) throws GeneralSecurityException {
|
||
|
ByteBuffer allocate = ByteBuffer.allocate(byteBuffer.remaining());
|
||
|
c(bArr, allocate, byteBuffer);
|
||
|
return allocate.array();
|
||
|
}
|
||
|
|
||
|
private void c(byte[] bArr, ByteBuffer byteBuffer, ByteBuffer byteBuffer2) throws GeneralSecurityException {
|
||
|
if (bArr.length != b()) {
|
||
|
StringBuilder sb = new StringBuilder("The nonce length (in bytes) must be ");
|
||
|
sb.append(b());
|
||
|
throw new GeneralSecurityException(sb.toString());
|
||
|
}
|
||
|
int remaining = byteBuffer2.remaining();
|
||
|
int i = remaining / 64;
|
||
|
for (int i2 = 0; i2 < i + 1; i2++) {
|
||
|
ByteBuffer b = b(bArr, this.e + i2);
|
||
|
if (i2 == i) {
|
||
|
vil.a(byteBuffer, byteBuffer2, b, remaining % 64);
|
||
|
} else {
|
||
|
vil.a(byteBuffer, byteBuffer2, b, 64);
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
|
||
|
/* JADX INFO: Access modifiers changed from: package-private */
|
||
|
public final ByteBuffer b(byte[] bArr, int i) {
|
||
|
int[] e = e(C11262eby.d(bArr), i);
|
||
|
int[] iArr = (int[]) e.clone();
|
||
|
C11262eby.c(iArr);
|
||
|
for (int i2 = 0; i2 < e.length; i2++) {
|
||
|
e[i2] = e[i2] + iArr[i2];
|
||
|
}
|
||
|
ByteBuffer order = ByteBuffer.allocate(64).order(ByteOrder.LITTLE_ENDIAN);
|
||
|
order.asIntBuffer().put(e, 0, 16);
|
||
|
return order;
|
||
|
}
|
||
|
}
|