42 lines
1.4 KiB
Java
42 lines
1.4 KiB
Java
package o;
|
|
|
|
/* loaded from: classes2.dex */
|
|
public final class KzA {
|
|
private static final char[] a = "0123456789ABCDEF".toCharArray();
|
|
|
|
public static byte[] b(String str) {
|
|
char[] charArray = str.toCharArray();
|
|
if ((charArray.length & 1) != 0) {
|
|
throw new IllegalArgumentException("Odd number of characters.");
|
|
}
|
|
byte[] bArr = new byte[charArray.length >> 1];
|
|
int i = 0;
|
|
int i2 = 0;
|
|
while (i < charArray.length) {
|
|
int digit = Character.digit(charArray[i], 16);
|
|
if (digit == -1) {
|
|
throw new IllegalArgumentException("Illegal hexadecimal character at index ".concat(String.valueOf(i)));
|
|
}
|
|
int i3 = i + 1;
|
|
int digit2 = Character.digit(charArray[i3], 16);
|
|
if (digit2 == -1) {
|
|
throw new IllegalArgumentException("Illegal hexadecimal character at index ".concat(String.valueOf(i3)));
|
|
}
|
|
i += 2;
|
|
bArr[i2] = (byte) ((digit << 4) | digit2);
|
|
i2++;
|
|
}
|
|
return bArr;
|
|
}
|
|
|
|
public static String e(byte[] bArr) {
|
|
StringBuilder sb = new StringBuilder(bArr.length << 1);
|
|
for (byte b : bArr) {
|
|
char[] cArr = a;
|
|
sb.append(cArr[(b >> 4) & 15]);
|
|
sb.append(cArr[b & 15]);
|
|
}
|
|
return sb.toString();
|
|
}
|
|
}
|