package p000667129a30fe2dba1ef578a30daec00e4.com.dingxiang.mobile.utils;
import java.io.UnsupportedEncodingException;
/* renamed from: 667129a30fe2dba1ef578a30daec00e4.com.dingxiang.mobile.utils.DXBase64 reason: invalid package */
public class DXBase64 {
static final /* synthetic */ boolean $assertionsDisabled = false;
public static final int CRLF = 4;
public static final int DEFAULT = 0;
public static final int NO_CLOSE = 16;
public static final int NO_PADDING = 1;
public static final int NO_WRAP = 2;
public static final int URL_SAFE = 8;
/* renamed from: 667129a30fe2dba1ef578a30daec00e4.com.dingxiang.mobile.utils.DXBase64$Coder */
static abstract class Coder {
public int op;
public byte[] output;
public abstract int maxOutputSize (int i);
public abstract boolean process (byte[] bArr, int i, int i2, boolean z);
Coder () {
}
}
public static byte[] decode (String str, int i) {
return decode (str.getBytes (), i);
}
public static byte[] decode (byte[] bArr, int i) {
return decode (bArr, 0, bArr.length, i);
}
public static byte[] decode (byte[] bArr, int i, int i2, int i3) {
Decoder decoder = new Decoder (i3, new byte[ ( (i2 * 3) / 4)]);
if (!decoder.process (bArr, i, i2, true)) {
throw new IllegalArgumentException ("bad base-64");
} else if (decoder.op == decoder.output.length) {
return decoder.output;
} else {
byte[] bArr2 = new byte[decoder.op];
System.arraycopy (decoder.output, 0, bArr2, 0, decoder.op);
return bArr2;
}
}
/* renamed from: 667129a30fe2dba1ef578a30daec00e4.com.dingxiang.mobile.utils.DXBase64$Decoder */
static class Decoder extends Coder {
private static final int[] DECODE = {-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 62, -1, -1, -1, 63, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, -1, -1, -1, -2, -1, -1, -1, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, -1, -1, -1, -1, -1, -1, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1};
private static final int[] DECODE_WEBSAFE = {-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 62, -1, -1, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, -1, -1, -1, -2, -1, -1, -1, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, -1, -1, -1, -1, 63, -1, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1};
private static final int EQUALS = -2;
private static final int SKIP = -1;
private final int[] alphabet;
private int state;
private int value;
public Decoder (int i, byte[] bArr) {
this.output = bArr;
this.alphabet = (i & 8) == 0 ? DECODE : DECODE_WEBSAFE;
this.state = 0;
this.value = 0;
}
public int maxOutputSize (int i) {
return ( (i * 3) / 4) + 10;
}
/* JADX WARNING: Removed duplicated region for block: B:50:0x00e4 */
/* JADX WARNING: Removed duplicated region for block: B:52:0x00eb */
/* JADX WARNING: Removed duplicated region for block: B:64:0x00e1 A[SYNTHETIC] */
/* Code decompiled incorrectly, please refer to instructions dump. */
public boolean process (byte[] r12, int r13, int r14, boolean r15) {
throw new UnsupportedOperationException ("Method not decompiled: p000667129a30fe2dba1ef578a30daec00e4.com.dingxiang.mobile.utils.DXBase64.Decoder.process (byte[], int, int, boolean):boolean");
}
}
public static String encodeToString (byte[] bArr, int i) {
try {
return new String (encode (bArr, i), "US-ASCII");
} catch (UnsupportedEncodingException e) {
throw new AssertionError (e);
}
}
public static String encodeToString (byte[] bArr, int i, int i2, int i3) {
try {
return new String (encode (bArr, i, i2, i3), "US-ASCII");
} catch (UnsupportedEncodingException e) {
throw new AssertionError (e);
}
}
public static byte[] encode (byte[] bArr, int i) {
return encode (bArr, 0, bArr.length, i);
}
public static byte[] encode (byte[] bArr, int i, int i2, int i3) {
Encoder encoder = new Encoder (i3, (byte[]) null);
int i4 = (i2 / 3) * 4;
if (!encoder.do_padding) {
switch (i2 % 3) {
case 1:
i4 += 2;
break;
case 2:
i4 += 3;
break;
}
} else if (i2 % 3 > 0) {
i4 += 4;
}
if (encoder.do_newline && i2 > 0) {
i4 += ( ( (i2 - 1) / 57) + 1) * (encoder.do_cr ? 2 : 1);
}
encoder.output = new byte[i4];
encoder.process (bArr, i, i2, true);
return encoder.output;
}
/* renamed from: 667129a30fe2dba1ef578a30daec00e4.com.dingxiang.mobile.utils.DXBase64$Encoder */
static class Encoder extends Coder {
static final /* synthetic */ boolean $assertionsDisabled = false;
private static final byte[] ENCODE = {65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 43, 47};
private static final byte[] ENCODE_WEBSAFE = {65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 45, 95};
public static final int LINE_GROUPS = 19;
private final byte[] alphabet;
private int count;
public final boolean do_cr;
public final boolean do_newline;
public final boolean do_padding;
private final byte[] tail;
int tailLen;
static {
Class cls = DXBase64.class;
}
public Encoder (int i, byte[] bArr) {
this.output = bArr;
boolean z = true;
this.do_padding = (i & 1) == 0;
this.do_newline = (i & 2) == 0;
this.do_cr = (i & 4) == 0 ? false : z;
this.alphabet = (i & 8) == 0 ? ENCODE : ENCODE_WEBSAFE;
this.tail = new byte[2];
this.tailLen = 0;
this.count = this.do_newline ? 19 : -1;
}
public int maxOutputSize (int i) {
return ( (i * 8) / 5) + 10;
}
/* JADX WARNING: Can /* Code decompiled incorrectly, please refer to instructions dump. */
public boolean process (byte[] r18, int r19, int r20, boolean r21) {
throw new UnsupportedOperationException ("Method not decompiled: p000667129a30fe2dba1ef578a30daec00e4.com.dingxiang.mobile.utils.DXBase64.Encoder.process (byte[], int, int, boolean):boolean");
}
}
private DXBase64 () {
}
}