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

203 lines
6.3 KiB
Java
Raw Normal View History

2024-07-27 18:17:47 +07:00
package o;
import com.google.common.base.Ascii;
import com.google.common.primitives.UnsignedBytes;
import io.flutter.embedding.android.KeyboardMap;
import java.io.BufferedInputStream;
import java.io.FilterInputStream;
import java.io.IOException;
import java.io.InputStream;
import org.bouncycastle.crypto.tls.CipherSuite;
/* loaded from: classes.dex */
public final class iPA extends FilterInputStream {
private static final short a = (short) ((Math.sqrt(5.0d) - 1.0d) * Math.pow(2.0d, 15.0d));
private int b;
private byte[] c;
private byte[] d;
private byte[] e;
private int f;
private int g;
private int h;
private int i;
private int j;
private int k;
private final int l;
private final int m;
private int n;
/* renamed from: o, reason: collision with root package name */
private int f9172o;
private int p;
@Override // java.io.FilterInputStream, java.io.InputStream
public final boolean markSupported() {
return false;
}
public iPA(InputStream inputStream, int[] iArr, int i, byte[] bArr, int i2, int i3) throws IOException {
this(inputStream, iArr, i, bArr, i2, i3, (byte) 0);
}
private iPA(InputStream inputStream, int[] iArr, int i, byte[] bArr, int i2, int i3, byte b) throws IOException {
super(new BufferedInputStream(inputStream, 4096));
this.g = Integer.MAX_VALUE;
this.p = 1;
this.e = new byte[8];
this.d = new byte[8];
this.c = new byte[8];
this.b = 8;
this.j = 8;
this.i = Math.min(Math.max(i2, 5), 16);
this.f = i3;
if (i3 == 3) {
System.arraycopy(bArr, 0, this.d, 0, 8);
}
long j = (iArr[1] & KeyboardMap.kValueMask) | ((iArr[0] & KeyboardMap.kValueMask) << 32);
if (i != 0) {
int i4 = (int) j;
this.h = i4;
this.n = i4 * i;
this.k = i ^ i4;
this.f9172o = (int) (j >> 32);
} else {
this.h = (int) j;
long j2 = j >> 3;
short s = a;
this.n = (int) ((s * j2) >> 32);
this.k = (int) (j >> 32);
this.f9172o = (int) (j2 + s);
}
this.l = 100;
this.m = 100;
}
@Override // java.io.FilterInputStream, java.io.InputStream
public final int read() throws IOException {
c();
int i = this.b;
if (i >= this.j) {
return -1;
}
byte[] bArr = this.e;
this.b = i + 1;
return bArr[i] & UnsignedBytes.MAX_VALUE;
}
@Override // java.io.FilterInputStream, java.io.InputStream
public final int read(byte[] bArr, int i, int i2) throws IOException {
int i3 = i + i2;
for (int i4 = i; i4 < i3; i4++) {
c();
int i5 = this.b;
if (i5 >= this.j) {
if (i4 == i) {
return -1;
}
return i2 - (i3 - i4);
}
byte[] bArr2 = this.e;
this.b = i5 + 1;
bArr[i4] = bArr2[i5];
}
return i2;
}
@Override // java.io.FilterInputStream, java.io.InputStream
public final long skip(long j) throws IOException {
long j2 = 0;
while (j2 < j && read() != -1) {
j2++;
}
return j2;
}
@Override // java.io.FilterInputStream, java.io.InputStream
public final int available() throws IOException {
c();
return this.j - this.b;
}
private void b() {
if (this.f == 3) {
byte[] bArr = this.e;
System.arraycopy(bArr, 0, this.c, 0, bArr.length);
}
byte[] bArr2 = this.e;
int i = ((bArr2[0] << Ascii.CAN) & (-16777216)) + ((bArr2[1] << 16) & 16711680) + ((bArr2[2] << 8) & CipherSuite.DRAFT_TLS_DHE_RSA_WITH_AES_128_OCB) + (bArr2[3] & UnsignedBytes.MAX_VALUE);
int i2 = ((-16777216) & (bArr2[4] << Ascii.CAN)) + (16711680 & (bArr2[5] << 16)) + (65280 & (bArr2[6] << 8)) + (bArr2[7] & UnsignedBytes.MAX_VALUE);
int i3 = 0;
while (true) {
int i4 = this.i;
if (i3 >= i4) {
break;
}
short s = a;
i2 -= ((((i4 - i3) * s) + i) ^ ((i << 4) + this.k)) ^ ((i >>> 5) + this.f9172o);
i -= (((i2 << 4) + this.h) ^ ((s * (i4 - i3)) + i2)) ^ ((i2 >>> 5) + this.n);
i3++;
}
byte[] bArr3 = this.e;
bArr3[0] = (byte) (i >> 24);
bArr3[1] = (byte) (i >> 16);
bArr3[2] = (byte) (i >> 8);
bArr3[3] = (byte) i;
bArr3[4] = (byte) (i2 >> 24);
bArr3[5] = (byte) (i2 >> 16);
bArr3[6] = (byte) (i2 >> 8);
bArr3[7] = (byte) i2;
if (this.f == 3) {
for (int i5 = 0; i5 < 8; i5++) {
byte[] bArr4 = this.e;
bArr4[i5] = (byte) (bArr4[i5] ^ this.d[i5]);
}
byte[] bArr5 = this.c;
System.arraycopy(bArr5, 0, this.d, 0, bArr5.length);
}
}
private int c() throws IOException {
if (this.g == Integer.MAX_VALUE) {
this.g = ((FilterInputStream) this).in.read();
}
if (this.b == 8) {
byte[] bArr = this.e;
int i = this.g;
bArr[0] = (byte) i;
if (i < 0) {
throw new IllegalStateException("unexpected block size");
}
int i2 = 1;
do {
int read = ((FilterInputStream) this).in.read(this.e, i2, 8 - i2);
if (read <= 0) {
break;
}
i2 += read;
} while (i2 < 8);
if (i2 < 8) {
throw new IllegalStateException("unexpected block size");
}
int i3 = this.l;
if (i3 == this.m) {
b();
} else {
if (this.p <= i3) {
b();
}
int i4 = this.p;
if (i4 < this.m) {
this.p = i4 + 1;
} else {
this.p = 1;
}
}
int read2 = ((FilterInputStream) this).in.read();
this.g = read2;
this.b = 0;
this.j = read2 < 0 ? 8 - (this.e[7] & UnsignedBytes.MAX_VALUE) : 8;
}
return this.j;
}
}