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

117 lines
3.9 KiB
Java
Raw Normal View History

2024-07-27 18:17:47 +07:00
package o;
import com.google.common.primitives.UnsignedBytes;
import java.util.Arrays;
import o.C15155gij;
/* loaded from: classes.dex */
public final class giC {
private static final byte[] c;
static {
C15155gij.LWm lWm = C15155gij.c;
c = C15155gij.LWm.e("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/").b;
C15155gij.LWm lWm2 = C15155gij.c;
byte[] bArr = C15155gij.LWm.e("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_").b;
}
public static final byte[] d(String str) {
int i;
char charAt;
C14957gcv.e(str, "");
int length = str.length();
while (length > 0 && ((charAt = str.charAt(length - 1)) == '=' || charAt == '\n' || charAt == '\r' || charAt == ' ' || charAt == '\t')) {
length--;
}
int i2 = (int) ((length * 6) / 8);
byte[] bArr = new byte[i2];
int i3 = 0;
int i4 = 0;
int i5 = 0;
for (int i6 = 0; i6 < length; i6++) {
char charAt2 = str.charAt(i6);
if ('A' <= charAt2 && charAt2 < '[') {
i = charAt2 - 'A';
} else if ('a' <= charAt2 && charAt2 < '{') {
i = charAt2 - 'G';
} else if ('0' <= charAt2 && charAt2 < ':') {
i = charAt2 + 4;
} else if (charAt2 == '+' || charAt2 == '-') {
i = 62;
} else if (charAt2 == '/' || charAt2 == '_') {
i = 63;
} else {
if (charAt2 != '\n' && charAt2 != '\r' && charAt2 != ' ' && charAt2 != '\t') {
return null;
}
}
i4 = (i4 << 6) | i;
i3++;
if (i3 % 4 == 0) {
bArr[i5] = (byte) (i4 >> 16);
bArr[i5 + 1] = (byte) (i4 >> 8);
bArr[i5 + 2] = (byte) i4;
i5 += 3;
}
}
int i7 = i3 % 4;
if (i7 == 1) {
return null;
}
if (i7 == 2) {
bArr[i5] = (byte) ((i4 << 12) >> 16);
i5++;
} else if (i7 == 3) {
int i8 = i4 << 6;
bArr[i5] = (byte) (i8 >> 16);
bArr[i5 + 1] = (byte) (i8 >> 8);
i5 += 2;
}
if (i5 == i2) {
return bArr;
}
byte[] copyOf = Arrays.copyOf(bArr, i5);
C14957gcv.c(copyOf, "");
return copyOf;
}
public static /* synthetic */ String b(byte[] bArr) {
byte[] bArr2 = c;
C14957gcv.e(bArr, "");
C14957gcv.e(bArr2, "");
byte[] bArr3 = new byte[((bArr.length + 2) / 3) << 2];
int length = bArr.length - (bArr.length % 3);
int i = 0;
int i2 = 0;
while (i < length) {
byte b = bArr[i];
byte b2 = bArr[i + 1];
int i3 = i + 3;
byte b3 = bArr[i + 2];
bArr3[i2] = bArr2[(b & UnsignedBytes.MAX_VALUE) >> 2];
bArr3[i2 + 1] = bArr2[((b & 3) << 4) | ((b2 & UnsignedBytes.MAX_VALUE) >> 4)];
bArr3[i2 + 2] = bArr2[((b2 & 15) << 2) | ((b3 & UnsignedBytes.MAX_VALUE) >> 6)];
bArr3[i2 + 3] = bArr2[b3 & 63];
i2 += 4;
i = i3;
}
int length2 = bArr.length - length;
if (length2 == 1) {
byte b4 = bArr[i];
bArr3[i2] = bArr2[(b4 & UnsignedBytes.MAX_VALUE) >> 2];
bArr3[i2 + 1] = bArr2[(b4 & 3) << 4];
bArr3[i2 + 2] = 61;
bArr3[i2 + 3] = 61;
} else if (length2 == 2) {
byte b5 = bArr[i];
byte b6 = bArr[i + 1];
bArr3[i2] = bArr2[(b5 & UnsignedBytes.MAX_VALUE) >> 2];
bArr3[i2 + 1] = bArr2[((b5 & 3) << 4) | ((b6 & UnsignedBytes.MAX_VALUE) >> 4)];
bArr3[i2 + 2] = bArr2[(b6 & 15) << 2];
bArr3[i2 + 3] = 61;
}
C14957gcv.e(bArr3, "");
return new String(bArr3, gdP.a);
}
}