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

107 lines
3.7 KiB
Java
Raw Normal View History

2024-07-27 18:17:47 +07:00
package o;
import com.google.common.primitives.UnsignedBytes;
import com.huawei.hms.framework.common.ContainerUtils;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
/* renamed from: o.gmH, reason: case insensitive filesystem */
/* loaded from: classes6.dex */
public final class C15274gmH {
private static char[] c = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".toCharArray();
public static String a(byte[] bArr) {
int length = bArr.length;
StringBuffer stringBuffer = new StringBuffer((bArr.length * 3) / 2);
int i = 0;
loop0: while (true) {
int i2 = 0;
while (i <= length - 3) {
int i3 = ((bArr[i] & UnsignedBytes.MAX_VALUE) << 16) | ((bArr[i + 1] & UnsignedBytes.MAX_VALUE) << 8) | (bArr[i + 2] & UnsignedBytes.MAX_VALUE);
char[] cArr = c;
stringBuffer.append(cArr[(i3 >> 18) & 63]);
stringBuffer.append(cArr[(i3 >> 12) & 63]);
stringBuffer.append(cArr[(i3 >> 6) & 63]);
stringBuffer.append(cArr[i3 & 63]);
i += 3;
if (i2 >= 14) {
break;
}
i2++;
}
stringBuffer.append("\r\n");
}
if (i == length - 2) {
int i4 = ((bArr[i + 1] & UnsignedBytes.MAX_VALUE) << 8) | ((bArr[i] & UnsignedBytes.MAX_VALUE) << 16);
char[] cArr2 = c;
stringBuffer.append(cArr2[(i4 >> 18) & 63]);
stringBuffer.append(cArr2[(i4 >> 12) & 63]);
stringBuffer.append(cArr2[(i4 >> 6) & 63]);
stringBuffer.append(ContainerUtils.KEY_VALUE_DELIMITER);
} else if (i == length - 1) {
int i5 = (bArr[i] & UnsignedBytes.MAX_VALUE) << 16;
char[] cArr3 = c;
stringBuffer.append(cArr3[(i5 >> 18) & 63]);
stringBuffer.append(cArr3[(i5 >> 12) & 63]);
stringBuffer.append("==");
}
return stringBuffer.toString();
}
private static int b(char c2) {
if (c2 >= 'A' && c2 <= 'Z') {
return c2 - 'A';
}
if (c2 >= 'a' && c2 <= 'z') {
return c2 - 'G';
}
if (c2 >= '0' && c2 <= '9') {
return c2 + 4;
}
if (c2 == '+') {
return 62;
}
if (c2 == '/') {
return 63;
}
if (c2 == '=') {
return 0;
}
throw new RuntimeException("unexpected code: ".concat(String.valueOf(c2)));
}
public static byte[] e(String str) {
ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream();
try {
int length = str.length();
int i = 0;
while (true) {
if (i < length) {
if (str.charAt(i) <= ' ') {
i++;
}
}
if (i == length) {
break;
}
int i2 = i + 2;
int i3 = i + 3;
int b = (b(str.charAt(i)) << 18) + (b(str.charAt(i + 1)) << 12) + (b(str.charAt(i2)) << 6) + b(str.charAt(i3));
byteArrayOutputStream.write((b >> 16) & 255);
if (str.charAt(i2) == '=') {
break;
}
byteArrayOutputStream.write((b >> 8) & 255);
if (str.charAt(i3) == '=') {
break;
}
byteArrayOutputStream.write(b & 255);
i += 4;
}
return byteArrayOutputStream.toByteArray();
} catch (IOException unused) {
throw new RuntimeException();
}
}
}