161 lines
4.6 KiB
Java
161 lines
4.6 KiB
Java
package o;
|
|
|
|
import com.google.common.primitives.UnsignedBytes;
|
|
import java.io.BufferedInputStream;
|
|
import java.io.FilterInputStream;
|
|
import java.io.IOException;
|
|
import java.io.InputStream;
|
|
|
|
/* loaded from: classes2.dex */
|
|
public final class EdS extends FilterInputStream {
|
|
private final int a;
|
|
private long[] b;
|
|
private final int c;
|
|
private final int d;
|
|
private int e;
|
|
private byte[] f;
|
|
private short g;
|
|
private int h;
|
|
private long[] i;
|
|
private int j;
|
|
private int n;
|
|
|
|
@Override // java.io.FilterInputStream, java.io.InputStream
|
|
public final boolean markSupported() {
|
|
return false;
|
|
}
|
|
|
|
public EdS(InputStream inputStream, int i, int i2, short s, int i3, int i4) throws IOException {
|
|
this(inputStream, i, i2, s, i3, i4, (byte) 0);
|
|
}
|
|
|
|
private EdS(InputStream inputStream, int i, int i2, short s, int i3, int i4, byte b) throws IOException {
|
|
super(new BufferedInputStream(inputStream, 4096));
|
|
this.e = 1;
|
|
this.h = Integer.MAX_VALUE;
|
|
int min = Math.min(Math.max((int) s, 4), 8);
|
|
this.c = min;
|
|
this.f = new byte[min];
|
|
this.b = new long[4];
|
|
this.i = new long[4];
|
|
this.j = min;
|
|
this.n = min;
|
|
this.b = znH.c(i ^ i4, min ^ i4);
|
|
this.i = znH.c(i2 ^ i4, i3 ^ i4);
|
|
this.d = 100;
|
|
this.a = 100;
|
|
}
|
|
|
|
@Override // java.io.FilterInputStream, java.io.InputStream
|
|
public final int read() throws IOException {
|
|
e();
|
|
int i = this.j;
|
|
if (i >= this.n) {
|
|
return -1;
|
|
}
|
|
byte[] bArr = this.f;
|
|
this.j = 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++) {
|
|
e();
|
|
int i5 = this.j;
|
|
if (i5 >= this.n) {
|
|
if (i4 == i) {
|
|
return -1;
|
|
}
|
|
return i2 - (i3 - i4);
|
|
}
|
|
byte[] bArr2 = this.f;
|
|
this.j = 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 {
|
|
e();
|
|
return this.n - this.j;
|
|
}
|
|
|
|
private void b() {
|
|
long[] jArr = this.b;
|
|
long[] jArr2 = this.i;
|
|
short s = this.g;
|
|
long j = jArr[s % 4] * 2147483085;
|
|
long j2 = jArr2[(s + 2) % 4];
|
|
int i = (s + 3) % 4;
|
|
jArr2[i] = ((jArr[i] * 2147483085) + j2) / 2147483647L;
|
|
jArr[i] = (j + j2) % 2147483647L;
|
|
for (int i2 = 0; i2 < this.c; i2++) {
|
|
this.f[i2] = (byte) (r1[i2] ^ ((this.b[this.g] >> (i2 << 3)) & 255));
|
|
}
|
|
this.g = (short) ((this.g + 1) % 4);
|
|
}
|
|
|
|
private int e() throws IOException {
|
|
int i;
|
|
if (this.h == Integer.MAX_VALUE) {
|
|
this.h = ((FilterInputStream) this).in.read();
|
|
}
|
|
if (this.j == this.c) {
|
|
byte[] bArr = this.f;
|
|
int i2 = this.h;
|
|
bArr[0] = (byte) i2;
|
|
if (i2 < 0) {
|
|
throw new IllegalStateException("unexpected block size");
|
|
}
|
|
int i3 = 1;
|
|
do {
|
|
int read = ((FilterInputStream) this).in.read(this.f, i3, this.c - i3);
|
|
if (read <= 0) {
|
|
break;
|
|
}
|
|
i3 += read;
|
|
} while (i3 < this.c);
|
|
if (i3 < this.c) {
|
|
throw new IllegalStateException("unexpected block size");
|
|
}
|
|
int i4 = this.d;
|
|
if (i4 == this.a) {
|
|
b();
|
|
} else {
|
|
if (this.e <= i4) {
|
|
b();
|
|
}
|
|
int i5 = this.e;
|
|
if (i5 < this.a) {
|
|
this.e = i5 + 1;
|
|
} else {
|
|
this.e = 1;
|
|
}
|
|
}
|
|
int read2 = ((FilterInputStream) this).in.read();
|
|
this.h = read2;
|
|
this.j = 0;
|
|
if (read2 < 0) {
|
|
int i6 = this.c;
|
|
i = i6 - (this.f[i6 - 1] & UnsignedBytes.MAX_VALUE);
|
|
} else {
|
|
i = this.c;
|
|
}
|
|
this.n = i;
|
|
}
|
|
return this.n;
|
|
}
|
|
}
|