what-the-bank/sources/com/facetec/sdk/mu.java

113 lines
4.2 KiB
Java
Raw Permalink Normal View History

2024-07-27 18:17:47 +07:00
package com.facetec.sdk;
import com.google.common.primitives.UnsignedBytes;
import java.io.UnsupportedEncodingException;
import net.sf.scuba.smartcards.ISO7816;
import net.sf.scuba.smartcards.ISOFileInfo;
import org.jmrtd.lds.CVCAFile;
/* loaded from: classes.dex */
final class mu {
private static final byte[] b = {65, CVCAFile.CAR_TAG, 67, ISO7816.INS_REHABILITATE_CHV, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 97, ISOFileInfo.FCP_BYTE, 99, ISOFileInfo.FMD_BYTE, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, ISOFileInfo.FCI_BYTE, ISO7816.INS_MANAGE_CHANNEL, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, ISO7816.INS_DECREASE, 49, ISO7816.INS_INCREASE, 51, ISO7816.INS_DECREASE_STAMPED, 53, 54, 55, 56, 57, 43, 47};
public static byte[] d(String str) {
int i;
char charAt;
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 (charAt2 >= 'A' && charAt2 <= 'Z') {
i = charAt2 - 'A';
} else if (charAt2 >= 'a' && charAt2 <= 'z') {
i = charAt2 - 'G';
} else if (charAt2 >= '0' && charAt2 <= '9') {
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;
}
}
i5 = (i5 << 6) | ((byte) i);
i3++;
if (i3 % 4 == 0) {
bArr[i4] = (byte) (i5 >> 16);
bArr[i4 + 1] = (byte) (i5 >> 8);
bArr[i4 + 2] = (byte) i5;
i4 += 3;
}
}
int i7 = i3 % 4;
if (i7 == 1) {
return null;
}
if (i7 == 2) {
bArr[i4] = (byte) ((i5 << 12) >> 16);
i4++;
} else if (i7 == 3) {
int i8 = i5 << 6;
bArr[i4] = (byte) (i8 >> 16);
bArr[i4 + 1] = (byte) (i8 >> 8);
i4 += 2;
}
if (i4 == i2) {
return bArr;
}
byte[] bArr2 = new byte[i4];
System.arraycopy(bArr, 0, bArr2, 0, i4);
return bArr2;
}
public static String e(byte[] bArr) {
return c(bArr, b);
}
private static String c(byte[] bArr, byte[] 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) {
bArr3[i2] = bArr2[(bArr[i] & UnsignedBytes.MAX_VALUE) >> 2];
int i3 = i + 1;
bArr3[i2 + 1] = bArr2[((bArr[i] & 3) << 4) | ((bArr[i3] & UnsignedBytes.MAX_VALUE) >> 4)];
byte b2 = bArr[i3];
int i4 = i + 2;
bArr3[i2 + 2] = bArr2[((b2 & 15) << 2) | ((bArr[i4] & UnsignedBytes.MAX_VALUE) >> 6)];
bArr3[i2 + 3] = bArr2[bArr[i4] & 63];
i += 3;
i2 += 4;
}
int length2 = bArr.length % 3;
if (length2 == 1) {
bArr3[i2] = bArr2[(bArr[length] & UnsignedBytes.MAX_VALUE) >> 2];
bArr3[i2 + 1] = bArr2[(bArr[length] & 3) << 4];
bArr3[i2 + 2] = 61;
bArr3[i2 + 3] = 61;
} else if (length2 == 2) {
bArr3[i2] = bArr2[(bArr[length] & UnsignedBytes.MAX_VALUE) >> 2];
byte b3 = bArr[length];
int i5 = length + 1;
bArr3[i2 + 1] = bArr2[((b3 & 3) << 4) | ((bArr[i5] & UnsignedBytes.MAX_VALUE) >> 4)];
bArr3[i2 + 2] = bArr2[(bArr[i5] & 15) << 2];
bArr3[i2 + 3] = 61;
}
try {
return new String(bArr3, "US-ASCII");
} catch (UnsupportedEncodingException e) {
throw new AssertionError(e);
}
}
}