package o; import com.google.common.base.Ascii; import com.google.zxing.FormatException; import java.text.DecimalFormat; import net.sf.scuba.smartcards.ISO7816; import org.bouncycastle.crypto.tls.CipherSuite; /* loaded from: classes2.dex */ public final class wZb { private static final byte[] a = {53, 54, 43, ISO7816.INS_UNBLOCK_CHV, 45, 46, 47, ISO7816.INS_DECREASE, 37, 38}; private static final byte[] d = {55, 56, 57, 58, 59, 60, 49, ISO7816.INS_INCREASE, 51, ISO7816.INS_DECREASE_STAMPED}; private static final byte[] c = {39, 40, 41, ISO7816.INS_PSO, Ascii.US, 32}; private static final byte[] e = {33, ISO7816.INS_MSE, 35, ISO7816.INS_CHANGE_CHV, Ascii.EM, Ascii.SUB, Ascii.ESC, 28, 29, 30, 19, Ascii.DC4, Ascii.NAK, Ascii.SYN, Ascii.ETB, Ascii.CAN, 13, 14, 15, 16, 17, Ascii.DC2, 7, 8, 9, 10, 11, 12, 1, 2}; private static final byte[][] b = {new byte[]{39, 40, 41, ISO7816.INS_PSO, Ascii.US, 32}, new byte[]{33, ISO7816.INS_MSE, 35, ISO7816.INS_CHANGE_CHV, Ascii.EM, Ascii.SUB}, new byte[]{Ascii.ESC, 28, 29, 30, 19, Ascii.DC4}, new byte[]{Ascii.NAK, Ascii.SYN, Ascii.ETB, Ascii.CAN, 13, 14}, new byte[]{15, 16, 17, Ascii.DC2, 7, 8}, new byte[]{9, 10, 11, 12, 1, 2}}; private static final String[] j = {"\rABCDEFGHIJKLMNOPQRSTUVWXYZ\ufffa\u001c\u001d\u001e\ufffb \"#$%&'()*+,-./0123456789:\ufff1\ufff2\ufff3\ufff4\ufff8", "`abcdefghijklmnopqrstuvwxyz\ufffa\u001c\u001d\u001e\ufffb{}~\u007f;<=>?[\\]^_ ,./:@!|\ufff5\ufff6\ufff0\ufff2\ufff3\ufff4\ufff7", "ÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏÐÑÒÓÔÕÖ×ØÙÚ\ufffa\u001c\u001d\u001e\ufffbÛÜÝÞߪ¬±²³µ¹º¼½¾\u0080\u0081\u0082\u0083\u0084\u0085\u0086\u0087\u0088\u0089\ufff7 \ufff9\ufff3\ufff4\ufff8", "àáâãäåæçèéêëìíîïðñòóôõö÷øùú\ufffa\u001c\u001d\u001e\ufffbûüýþÿ¡¨«¯°´·¸»¿\u008a\u008b\u008c\u008d\u008e\u008f\u0090\u0091\u0092\u0093\u0094\ufff7 \ufff2\ufff9\ufff4\ufff8", "\u0000\u0001\u0002\u0003\u0004\u0005\u0006\u0007\b\t\n\u000b\f\r\u000e\u000f\u0010\u0011\u0012\u0013\u0014\u0015\u0016\u0017\u0018\u0019\u001a\ufffa\u001b\ufffb\u001c\u001d\u001e\u001f\u009f ¢£¤¥¦§©\u00ad®¶\u0095\u0096\u0097\u0098\u0099\u009a\u009b\u009c\u009d\u009e\ufff7 \ufff2\ufff3\ufff9\ufff8"}; public static Qys b(byte[] bArr, int i) throws FormatException { String obj; StringBuilder sb = new StringBuilder(CipherSuite.TLS_DHE_PSK_WITH_AES_128_CBC_SHA); if (i == 2 || i == 3) { if (i == 2) { int b2 = b(bArr, e); int b3 = b(bArr, c); if (b3 > 10) { throw FormatException.c(); } obj = new DecimalFormat("0000000000".substring(0, b3)).format(b2); } else { byte[][] bArr2 = b; StringBuilder sb2 = new StringBuilder(bArr2.length); for (byte[] bArr3 : bArr2) { sb2.append(j[0].charAt(b(bArr, bArr3))); } obj = sb2.toString(); } DecimalFormat decimalFormat = new DecimalFormat("000"); String format = decimalFormat.format(b(bArr, a)); String format2 = decimalFormat.format(b(bArr, d)); sb.append(a(bArr, 10, 84)); if (sb.toString().startsWith("[)>\u001e01\u001d")) { StringBuilder sb3 = new StringBuilder(); sb3.append(obj); sb3.append((char) 29); sb3.append(format); sb3.append((char) 29); sb3.append(format2); sb3.append((char) 29); sb.insert(9, sb3.toString()); } else { StringBuilder sb4 = new StringBuilder(); sb4.append(obj); sb4.append((char) 29); sb4.append(format); sb4.append((char) 29); sb4.append(format2); sb4.append((char) 29); sb.insert(0, sb4.toString()); } } else if (i == 4) { sb.append(a(bArr, 1, 93)); } else if (i == 5) { sb.append(a(bArr, 1, 77)); } return new Qys(bArr, sb.toString(), String.valueOf(i)); } private static int b(byte[] bArr, byte[] bArr2) { int i = 0; for (int i2 = 0; i2 < bArr2.length; i2++) { int i3 = bArr2[i2] - 1; i += (((1 << (5 - (i3 % 6))) & bArr[i3 / 6]) == 0 ? 0 : 1) << ((bArr2.length - i2) - 1); } return i; } private static String a(byte[] bArr, int i, int i2) { StringBuilder sb = new StringBuilder(); int i3 = i; int i4 = -1; int i5 = 0; int i6 = 0; while (i3 < i + i2) { char charAt = j[i5].charAt(bArr[i3]); switch (charAt) { case 65520: case 65521: case 65522: case 65523: case 65524: i6 = i5; i5 = charAt - 65520; i4 = 1; break; case 65525: i4 = 2; break; case 65526: i4 = 3; break; case 65527: i4 = -1; i5 = i6; break; case 65528: i4 = -1; i5 = 1; break; case 65529: i4 = -1; break; case 65530: default: sb.append(charAt); break; case 65531: byte b2 = bArr[i3 + 1]; byte b3 = bArr[i3 + 2]; byte b4 = bArr[i3 + 3]; byte b5 = bArr[i3 + 4]; i3 += 5; sb.append(new DecimalFormat("000000000").format((b2 << Ascii.CAN) + (b3 << Ascii.DC2) + (b4 << 12) + (b5 << 6) + bArr[i3])); break; } i6 = i5; i5 = 0; if (i4 == 0) { i5 = i6; } i3++; i4--; } while (sb.length() > 0 && sb.charAt(sb.length() - 1) == 65532) { sb.setLength(sb.length() - 1); } return sb.toString(); } }