85 lines
2.5 KiB
Java
85 lines
2.5 KiB
Java
package o;
|
|
|
|
import com.google.common.primitives.UnsignedBytes;
|
|
import java.io.IOException;
|
|
import java.io.OutputStream;
|
|
import net.sf.scuba.smartcards.ISO7816;
|
|
import net.sf.scuba.smartcards.ISOFileInfo;
|
|
|
|
/* loaded from: classes6.dex */
|
|
public final class grT implements grQ {
|
|
private byte[] a = {ISO7816.INS_DECREASE, 49, ISO7816.INS_INCREASE, 51, ISO7816.INS_DECREASE_STAMPED, 53, 54, 55, 56, 57, 97, ISOFileInfo.FCP_BYTE, 99, ISOFileInfo.FMD_BYTE, 101, 102};
|
|
private byte[] c = new byte[128];
|
|
|
|
private static boolean c(char c) {
|
|
return c == '\n' || c == '\r' || c == '\t' || c == ' ';
|
|
}
|
|
|
|
public grT() {
|
|
int i = 0;
|
|
int i2 = 0;
|
|
while (true) {
|
|
byte[] bArr = this.c;
|
|
if (i2 >= bArr.length) {
|
|
break;
|
|
}
|
|
bArr[i2] = -1;
|
|
i2++;
|
|
}
|
|
while (true) {
|
|
byte[] bArr2 = this.a;
|
|
if (i < bArr2.length) {
|
|
this.c[bArr2[i]] = (byte) i;
|
|
i++;
|
|
} else {
|
|
byte[] bArr3 = this.c;
|
|
bArr3[65] = bArr3[97];
|
|
bArr3[66] = bArr3[98];
|
|
bArr3[67] = bArr3[99];
|
|
bArr3[68] = bArr3[100];
|
|
bArr3[69] = bArr3[101];
|
|
bArr3[70] = bArr3[102];
|
|
return;
|
|
}
|
|
}
|
|
}
|
|
|
|
@Override // o.grQ
|
|
public final int e(byte[] bArr, int i, int i2, OutputStream outputStream) throws IOException {
|
|
for (int i3 = i; i3 < i + i2; i3++) {
|
|
byte b = bArr[i3];
|
|
outputStream.write(this.a[(b & UnsignedBytes.MAX_VALUE) >>> 4]);
|
|
outputStream.write(this.a[b & 15]);
|
|
}
|
|
return i2 << 1;
|
|
}
|
|
|
|
@Override // o.grQ
|
|
public final int e(String str, OutputStream outputStream) throws IOException {
|
|
int length = str.length();
|
|
while (length > 0 && c(str.charAt(length - 1))) {
|
|
length--;
|
|
}
|
|
int i = 0;
|
|
int i2 = 0;
|
|
while (i < length) {
|
|
while (i < length && c(str.charAt(i))) {
|
|
i++;
|
|
}
|
|
int i3 = i + 1;
|
|
byte b = this.c[str.charAt(i)];
|
|
while (i3 < length && c(str.charAt(i3))) {
|
|
i3++;
|
|
}
|
|
byte b2 = this.c[str.charAt(i3)];
|
|
if ((b | b2) < 0) {
|
|
throw new IOException("invalid characters encountered in Hex string");
|
|
}
|
|
outputStream.write((b << 4) | b2);
|
|
i2++;
|
|
i = i3 + 1;
|
|
}
|
|
return i2;
|
|
}
|
|
}
|