what-the-bank/sources/org/bouncycastle/crypto/engines/AESFastEngine.java

450 lines
46 KiB
Java
Raw Permalink Normal View History

2024-07-27 18:17:47 +07:00
package org.bouncycastle.crypto.engines;
import com.google.common.base.Ascii;
import com.google.common.primitives.SignedBytes;
import com.google.common.primitives.UnsignedBytes;
import java.lang.reflect.Array;
import java.nio.ByteBuffer;
import net.sf.scuba.smartcards.ISO7816;
import net.sf.scuba.smartcards.ISOFileInfo;
import org.bouncycastle.crypto.BlockCipher;
import org.bouncycastle.crypto.CipherParameters;
import org.bouncycastle.crypto.DataLengthException;
import org.bouncycastle.crypto.OutputLengthException;
import org.bouncycastle.crypto.params.KeyParameter;
import org.bouncycastle.crypto.signers.PSSSigner;
import org.bouncycastle.crypto.tls.CipherSuite;
import org.bouncycastle.i18n.LocalizedMessage;
import org.bouncycastle.util.Pack;
import org.jmrtd.lds.CVCAFile;
/* loaded from: classes6.dex */
public class AESFastEngine implements BlockCipher {
private static final int BLOCK_SIZE = 16;
private static final int[] T;
private static final int[] Tinv;
private static final int m1 = -2139062144;
private static final int m2 = 2139062143;
private static final int m3 = 27;
private static final int m4 = -1061109568;
private static final int m5 = 1061109567;
private int C0;
private int C1;
private int C2;
private int C3;
private int ROUNDS;
private int[][] WorkingKey = null;
private boolean forEncryption;
private static final byte[] S = {99, 124, 119, 123, -14, 107, ISOFileInfo.FCI_BYTE, -59, ISO7816.INS_DECREASE, 1, 103, 43, -2, -41, ISOFileInfo.AB, 118, ISO7816.INS_GET_DATA, -126, -55, 125, -6, 89, 71, -16, -83, -44, -94, -81, -100, -92, 114, ISO7816.INS_GET_RESPONSE, -73, -3, -109, 38, 54, 63, -9, -52, ISO7816.INS_DECREASE_STAMPED, ISOFileInfo.A5, -27, -15, 113, ISO7816.INS_LOAD_KEY_FILE, 49, Ascii.NAK, 4, -57, 35, -61, Ascii.CAN, -106, 5, -102, 7, Ascii.DC2, Byte.MIN_VALUE, ISO7816.INS_APPEND_RECORD, -21, 39, -78, 117, 9, ISOFileInfo.FILE_IDENTIFIER, ISO7816.INS_UNBLOCK_CHV, Ascii.SUB, Ascii.ESC, 110, 90, ISOFileInfo.A0, 82, 59, ISO7816.INS_UPDATE_BINARY, ISO7816.INS_READ_RECORD2, 41, -29, 47, -124, 83, -47, 0, -19, 32, -4, ISO7816.INS_READ_BINARY2, 91, 106, -53, -66, 57, 74, 76, 88, -49, ISO7816.INS_WRITE_BINARY, -17, -86, -5, 67, 77, 51, ISOFileInfo.PROP_INFO, 69, -7, 2, Ascii.DEL, 80, 60, -97, -88, 81, -93, SignedBytes.MAX_POWER_OF_TWO, -113, -110, -99, 56, -11, PSSSigner.TRAILER_IMPLICIT, ISO7816.INS_READ_RECORD_STAMPED, ISO7816.INS_PUT_DATA, 33, 16, -1, -13, ISO7816.INS_WRITE_RECORD, -51, 12, 19, -20, 95, -105, ISO7816.INS_REHABILITATE_CHV, Ascii.ETB, -60, -89, 126, 61, ISOFileInfo.FMD_BYTE, 93, Ascii.EM, 115, 96, ISOFileInfo.DATA_BYTES2, 79, ISO7816.INS_UPDATE_RECORD, ISO7816.INS_MSE, ISO7816.INS_PSO, -112, -120, 70, -18, -72, Ascii.DC4, -34, 94, 11, -37, ISO7816.INS_CREATE_FILE, ISO7816.INS_INCREASE, 58, 10, 73, 6, ISO7816.INS_CHANGE_CHV, 92, ISO7816.INS_ENVELOPE, -45, -84, ISOFileInfo.FCP_BYTE, -111, -107, ISO7816.INS_DELETE_FILE, 121, -25, -56, 55, 109, ISOFileInfo.ENV_TEMP_EF, -43, 78, -87, 108, 86, -12, -22, 101, 122, -82, 8, -70, 120, 37, 46, 28, -90, ISO7816.INS_READ_BINARY_STAMPED, -58, -24, -35, 116, Ascii.US, 75, -67, ISOFileInfo.SECURITY_ATTR_EXP, ISOFileInfo.LCS_BYTE, ISO7816.INS_MANAGE_CHANNEL, 62, -75, 102, 72, 3, -10, 14, 97, 53, 87, -71, -122, -63, 29, -98, -31, -8, -104, 17, 105, -39, ISOFileInfo.CHANNEL_SECURITY, -108, -101, 30, ISOFileInfo.FCI_EXT, -23, -50, 85, 40, -33, ISOFileInfo.SECURITY_ATTR_COMPACT, ISOFileInfo.A1, -119, 13, -65, -26, CVCAFile.CAR_TAG, 104, 65, -103, 45, 15, ISO7816.INS_READ_BINARY, 84, -69, Ascii.SYN};
private static final byte[] Si = {82, 9, 106, -43, ISO7816.INS_DECREASE, 54, ISOFileInfo.A5, 56, -65, SignedBytes.MAX_POWER_OF_TWO, -93, -98, ISOFileInfo.DATA_BYTES2, -13, -41, -5, 124, -29, 57, -126, -101, 47, -1, ISOFileInfo.FCI_EXT, ISO7816.INS_DECREASE_STAMPED, ISOFileInfo.CHANNEL_SECURITY, 67, ISO7816.INS_REHABILITATE_CHV, -60, -34, -23, -53, 84, 123, -108, ISO7816.INS_INCREASE, -90, ISO7816.INS_ENVELOPE, 35, 61, -18, 76, -107, 11, CVCAFile.CAR_TAG, -6, -61, 78, 8, 46, ISOFileInfo.A1, 102, 40, -39, ISO7816.INS_CHANGE_CHV, -78, 118, 91, -94, 73, 109, ISOFileInfo.SECURITY_ATTR_EXP, -47, 37, 114, -8, -10, ISOFileInfo.FMD_BYTE, -122, 104, -104, Ascii.SYN, -44, -92, 92, -52, 93, 101, ISO7816.INS_READ_RECORD_STAMPED, -110, 108, ISO7816.INS_MANAGE_CHANNEL, 72, 80, -3, -19, -71, ISO7816.INS_PUT_DATA, 94, Ascii.NAK, 70, 87, -89, ISOFileInfo.ENV_TEMP_EF, -99, -124, -112, ISO7816.INS_LOAD_KEY_FILE, ISOFileInfo.AB, 0, ISOFileInfo.SECURITY_ATTR_COMPACT, PSSSigner.TRAILER_IMPLICIT, -45, 10, -9, ISO7816.INS_DELETE_FILE, 88, 5, -72, ISO7816.INS_READ_RECORD2, 69, 6, ISO7816.INS_WRITE_BINARY, ISO7816.INS_UNBLOCK_CHV, 30, -113, ISO7816.INS_GET_DATA, 63, 15, 2, -63, -81, -67, 3, 1, 19, ISOFileInfo.LCS_BYTE, 107, 58, -111, 17, 65, 79, 103, ISO7816.INS_UPDATE_RECORD, -22, -105, -14, -49, -50, -16, ISO7816.INS_READ_BINARY_STAMPED, -26, 115, -106, -84, 116, ISO7816.INS_MSE, -25, -83, 53, ISOFileInfo.PROP_INFO, ISO7816.INS_APPEND_RECORD, -7, 55, -24, 28, 117, -33, 110, 71, -15, Ascii.SUB, 113, 29, 41, -59, -119, ISOFileInfo.FCI_BYTE, -73, ISOFileInfo.FCP_BYTE, 14, -86, Ascii.CAN, -66, Ascii.ESC, -4, 86, 62, 75, -58, ISO7816.INS_WRITE_RECORD, 121, 32, -102, -37, ISO7816.INS_GET_RESPONSE, -2, 120, -51, 90, -12, Ascii.US, -35, -88, 51, -120, 7, -57, 49, ISO7816.INS_READ_BINARY2, Ascii.DC2, 16, 89, 39, Byte.MIN_VALUE, -20, 95, 96, 81, Ascii.DEL, -87, Ascii.EM, -75, 74, 13, 45, -27, 122, -97, -109, -55, -100, -17, ISOFileInfo.A0, ISO7816.INS_CREATE_FILE, 59, 77, -82, ISO7816.INS_PSO, -11, ISO7816.INS_READ_BINARY, -56, -21, -69, 60, ISOFileInfo.FILE_IDENTIFIER, 83, -103, 97, Ascii.ETB, 43, 4, 126, -70, 119, ISO7816.INS_UPDATE_BINARY, 38, -31, 105, Ascii.DC4, 99, 85, 33, 12, 125};
private static final int[] rcon = {1, 2, 4, 8, 16, 32, 64, 128, 27, 54, 108, 216, CipherSuite.TLS_DHE_PSK_WITH_AES_256_GCM_SHA384, 77, CipherSuite.TLS_DHE_RSA_WITH_SEED_CBC_SHA, 47, 94, 188, 99, 198, 151, 53, 106, 212, CipherSuite.TLS_DHE_PSK_WITH_AES_256_CBC_SHA384, 125, 250, 239, CipherSuite.TLS_DH_anon_WITH_CAMELLIA_256_CBC_SHA256, CipherSuite.TLS_DHE_PSK_WITH_AES_256_CBC_SHA};
private static int FFmulX(int i) {
return ((i & m2) << 1) ^ (((m1 & i) >>> 7) * 27);
}
private static int FFmulX2(int i) {
int i2 = m4 & i;
int i3 = i2 ^ (i2 >>> 1);
return (((i & m5) << 2) ^ (i3 >>> 2)) ^ (i3 >>> 5);
}
private static int shift(int i, int i2) {
return (i >>> i2) | (i << (-i2));
}
@Override // org.bouncycastle.crypto.BlockCipher
public int getBlockSize() {
return 16;
}
@Override // org.bouncycastle.crypto.BlockCipher
public void reset() {
}
@Override // org.bouncycastle.crypto.BlockCipher
public int processBlock(byte[] bArr, int i, byte[] bArr2, int i2) {
if (this.WorkingKey == null) {
throw new IllegalStateException("AES engine not initialised");
}
if (i + 16 > bArr.length) {
throw new DataLengthException("input buffer too short");
}
if (i2 + 16 > bArr2.length) {
throw new OutputLengthException("output buffer too short");
}
unpackBlock(bArr, i);
if (this.forEncryption) {
encryptBlock(this.WorkingKey);
} else {
decryptBlock(this.WorkingKey);
}
packBlock(bArr2, i2);
return 16;
}
@Override // org.bouncycastle.crypto.BlockCipher
public void init(boolean z, CipherParameters cipherParameters) {
if (cipherParameters instanceof KeyParameter) {
this.WorkingKey = generateWorkingKey(((KeyParameter) cipherParameters).getKey(), z);
this.forEncryption = z;
} else {
StringBuilder sb = new StringBuilder("invalid parameter passed to AES init - ");
sb.append(cipherParameters.getClass().getName());
throw new IllegalArgumentException(sb.toString());
}
}
@Override // org.bouncycastle.crypto.BlockCipher
public String getAlgorithmName() {
return "AES";
}
private void unpackBlock(byte[] bArr, int i) {
this.C0 = Pack.littleEndianToInt(bArr, i);
this.C1 = Pack.littleEndianToInt(bArr, i + 4);
this.C2 = Pack.littleEndianToInt(bArr, i + 8);
this.C3 = Pack.littleEndianToInt(bArr, i + 12);
}
private static int subWord(int i) {
byte[] bArr = S;
return ((bArr[i >>> 24] & UnsignedBytes.MAX_VALUE) << 24) | (bArr[i & 255] & UnsignedBytes.MAX_VALUE) | ((bArr[(i >>> 8) & 255] & UnsignedBytes.MAX_VALUE) << 8) | ((bArr[(i >>> 16) & 255] & UnsignedBytes.MAX_VALUE) << 16);
}
private void packBlock(byte[] bArr, int i) {
Pack.intToLittleEndian(this.C0, bArr, i);
Pack.intToLittleEndian(this.C1, bArr, i + 4);
Pack.intToLittleEndian(this.C2, bArr, i + 8);
Pack.intToLittleEndian(this.C3, bArr, i + 12);
}
private static int inv_mcol(int i) {
int shift = shift(i, 8) ^ i;
int FFmulX = i ^ FFmulX(shift);
int FFmulX2 = shift ^ FFmulX2(FFmulX);
return FFmulX ^ (FFmulX2 ^ shift(FFmulX2, 16));
}
private int[][] generateWorkingKey(byte[] bArr, boolean z) {
int length = bArr.length;
if (length < 16 || length > 32 || (length & 7) != 0) {
throw new IllegalArgumentException("Key length not 128/192/256 bits.");
}
int i = length >>> 2;
this.ROUNDS = i + 6;
int[][] iArr = (int[][]) Array.newInstance((Class<?>) Integer.TYPE, i + 7, 4);
if (i == 4) {
int littleEndianToInt = Pack.littleEndianToInt(bArr, 0);
iArr[0][0] = littleEndianToInt;
int littleEndianToInt2 = Pack.littleEndianToInt(bArr, 4);
iArr[0][1] = littleEndianToInt2;
int littleEndianToInt3 = Pack.littleEndianToInt(bArr, 8);
iArr[0][2] = littleEndianToInt3;
int littleEndianToInt4 = Pack.littleEndianToInt(bArr, 12);
iArr[0][3] = littleEndianToInt4;
for (int i2 = 1; i2 <= 10; i2++) {
littleEndianToInt ^= subWord(shift(littleEndianToInt4, 8)) ^ rcon[i2 - 1];
int[] iArr2 = iArr[i2];
iArr2[0] = littleEndianToInt;
littleEndianToInt2 ^= littleEndianToInt;
iArr2[1] = littleEndianToInt2;
littleEndianToInt3 ^= littleEndianToInt2;
iArr2[2] = littleEndianToInt3;
littleEndianToInt4 ^= littleEndianToInt3;
iArr2[3] = littleEndianToInt4;
}
} else if (i == 6) {
int littleEndianToInt5 = Pack.littleEndianToInt(bArr, 0);
iArr[0][0] = littleEndianToInt5;
int littleEndianToInt6 = Pack.littleEndianToInt(bArr, 4);
iArr[0][1] = littleEndianToInt6;
int littleEndianToInt7 = Pack.littleEndianToInt(bArr, 8);
iArr[0][2] = littleEndianToInt7;
int littleEndianToInt8 = Pack.littleEndianToInt(bArr, 12);
iArr[0][3] = littleEndianToInt8;
int littleEndianToInt9 = Pack.littleEndianToInt(bArr, 16);
iArr[1][0] = littleEndianToInt9;
int littleEndianToInt10 = Pack.littleEndianToInt(bArr, 20);
iArr[1][1] = littleEndianToInt10;
int subWord = littleEndianToInt5 ^ (subWord(shift(littleEndianToInt10, 8)) ^ 1);
int[] iArr3 = iArr[1];
iArr3[2] = subWord;
int i3 = littleEndianToInt6 ^ subWord;
iArr3[3] = i3;
int i4 = littleEndianToInt7 ^ i3;
int[] iArr4 = iArr[2];
iArr4[0] = i4;
int i5 = littleEndianToInt8 ^ i4;
iArr4[1] = i5;
int i6 = littleEndianToInt9 ^ i5;
iArr4[2] = i6;
int i7 = littleEndianToInt10 ^ i6;
iArr4[3] = i7;
int i8 = 3;
int i9 = 2;
while (i8 < 12) {
int subWord2 = subWord ^ (subWord(shift(i7, 8)) ^ i9);
int[] iArr5 = iArr[i8];
iArr5[0] = subWord2;
int i10 = i3 ^ subWord2;
iArr5[1] = i10;
int i11 = i4 ^ i10;
iArr5[2] = i11;
int i12 = i5 ^ i11;
iArr5[3] = i12;
int i13 = i6 ^ i12;
int i14 = i8 + 1;
int[] iArr6 = iArr[i14];
iArr6[0] = i13;
int i15 = i7 ^ i13;
iArr6[1] = i15;
int i16 = i9 << 2;
subWord = subWord2 ^ ((i9 << 1) ^ subWord(shift(i15, 8)));
int[] iArr7 = iArr[i14];
iArr7[2] = subWord;
i3 = i10 ^ subWord;
iArr7[3] = i3;
i4 = i11 ^ i3;
int[] iArr8 = iArr[i8 + 2];
iArr8[0] = i4;
i5 = i12 ^ i4;
iArr8[1] = i5;
i6 = i13 ^ i5;
iArr8[2] = i6;
i7 = i15 ^ i6;
iArr8[3] = i7;
i8 += 3;
i9 = i16;
}
int subWord3 = (subWord(shift(i7, 8)) ^ 128) ^ subWord;
int[] iArr9 = iArr[12];
iArr9[0] = subWord3;
int i17 = subWord3 ^ i3;
iArr9[1] = i17;
int i18 = i17 ^ i4;
iArr9[2] = i18;
iArr9[3] = i18 ^ i5;
} else {
if (i != 8) {
throw new IllegalStateException("Should never get here");
}
int littleEndianToInt11 = Pack.littleEndianToInt(bArr, 0);
iArr[0][0] = littleEndianToInt11;
int littleEndianToInt12 = Pack.littleEndianToInt(bArr, 4);
iArr[0][1] = littleEndianToInt12;
int littleEndianToInt13 = Pack.littleEndianToInt(bArr, 8);
iArr[0][2] = littleEndianToInt13;
int littleEndianToInt14 = Pack.littleEndianToInt(bArr, 12);
iArr[0][3] = littleEndianToInt14;
int littleEndianToInt15 = Pack.littleEndianToInt(bArr, 16);
iArr[1][0] = littleEndianToInt15;
int littleEndianToInt16 = Pack.littleEndianToInt(bArr, 20);
iArr[1][1] = littleEndianToInt16;
int littleEndianToInt17 = Pack.littleEndianToInt(bArr, 24);
iArr[1][2] = littleEndianToInt17;
int littleEndianToInt18 = Pack.littleEndianToInt(bArr, 28);
iArr[1][3] = littleEndianToInt18;
int i19 = 2;
int i20 = 1;
while (i19 < 14) {
littleEndianToInt11 ^= subWord(shift(littleEndianToInt18, 8)) ^ i20;
int[] iArr10 = iArr[i19];
iArr10[0] = littleEndianToInt11;
littleEndianToInt12 ^= littleEndianToInt11;
iArr10[1] = littleEndianToInt12;
littleEndianToInt13 ^= littleEndianToInt12;
iArr10[2] = littleEndianToInt13;
littleEndianToInt14 ^= littleEndianToInt13;
iArr10[3] = littleEndianToInt14;
littleEndianToInt15 ^= subWord(littleEndianToInt14);
int[] iArr11 = iArr[i19 + 1];
iArr11[0] = littleEndianToInt15;
littleEndianToInt16 ^= littleEndianToInt15;
iArr11[1] = littleEndianToInt16;
littleEndianToInt17 ^= littleEndianToInt16;
iArr11[2] = littleEndianToInt17;
littleEndianToInt18 ^= littleEndianToInt17;
iArr11[3] = littleEndianToInt18;
i19 += 2;
i20 <<= 1;
}
int subWord4 = (subWord(shift(littleEndianToInt18, 8)) ^ i20) ^ littleEndianToInt11;
int[] iArr12 = iArr[14];
iArr12[0] = subWord4;
int i21 = subWord4 ^ littleEndianToInt12;
iArr12[1] = i21;
int i22 = i21 ^ littleEndianToInt13;
iArr12[2] = i22;
iArr12[3] = i22 ^ littleEndianToInt14;
}
if (!z) {
for (int i23 = 1; i23 < this.ROUNDS; i23++) {
for (int i24 = 0; i24 < 4; i24++) {
int[] iArr13 = iArr[i23];
iArr13[i24] = inv_mcol(iArr13[i24]);
}
}
}
return iArr;
}
private void encryptBlock(int[][] iArr) {
AESFastEngine aESFastEngine = this;
int i = aESFastEngine.C0;
char c = 0;
int[] iArr2 = iArr[0];
int i2 = i ^ iArr2[0];
int i3 = 1;
int i4 = aESFastEngine.C1 ^ iArr2[1];
char c2 = 2;
int i5 = aESFastEngine.C2 ^ iArr2[2];
char c3 = 3;
int i6 = iArr2[3] ^ aESFastEngine.C3;
int i7 = 1;
while (i7 < aESFastEngine.ROUNDS - i3) {
int[] iArr3 = T;
int i8 = iArr3[i2 & 255];
int i9 = iArr3[((i4 >>> 8) & 255) + 256];
int i10 = iArr3[((i5 >>> 16) & 255) + 512];
int i11 = iArr3[(i6 >>> 24) + 768];
int[] iArr4 = iArr[i7];
int i12 = (((i8 ^ i9) ^ i10) ^ i11) ^ iArr4[c];
int i13 = (((iArr3[i4 & 255] ^ iArr3[((i5 >>> 8) & 255) + 256]) ^ iArr3[((i6 >>> 16) & 255) + 512]) ^ iArr3[(i2 >>> 24) + 768]) ^ iArr4[i3];
int i14 = (((iArr3[i5 & 255] ^ iArr3[((i6 >>> 8) & 255) + 256]) ^ iArr3[((i2 >>> 16) & 255) + 512]) ^ iArr3[(i4 >>> 24) + 768]) ^ iArr4[c2];
int i15 = (((iArr3[((i2 >>> 8) & 255) + 256] ^ iArr3[i6 & 255]) ^ iArr3[((i4 >>> 16) & 255) + 512]) ^ iArr3[(i5 >>> 24) + 768]) ^ iArr4[c3];
int i16 = iArr3[i12 & 255];
int i17 = iArr3[((i13 >>> 8) & 255) + 256];
int i18 = iArr3[((i14 >>> 16) & 255) + 512];
int i19 = iArr3[(i15 >>> 24) + 768];
int[] iArr5 = iArr[i7 + 1];
int i20 = iArr5[c];
int i21 = iArr3[i13 & 255];
int i22 = iArr3[((i14 >>> 8) & 255) + 256];
int i23 = iArr3[((i15 >>> 16) & 255) + 512];
int i24 = iArr3[(i12 >>> 24) + 768];
int i25 = iArr5[1];
int i26 = iArr3[i14 & 255];
int i27 = iArr3[((i15 >>> 8) & 255) + 256];
int i28 = iArr3[((i12 >>> 16) & 255) + 512];
int i29 = iArr3[(i13 >>> 24) + 768];
int i30 = iArr5[2];
i7 += 2;
int i31 = (((i16 ^ i17) ^ i18) ^ i19) ^ i20;
i4 = (((i21 ^ i22) ^ i23) ^ i24) ^ i25;
i5 = (i29 ^ ((i27 ^ i26) ^ i28)) ^ i30;
c = 0;
i3 = 1;
c2 = 2;
c3 = 3;
aESFastEngine = this;
i6 = (((iArr3[i15 & 255] ^ iArr3[((i12 >>> 8) & 255) + 256]) ^ iArr3[((i13 >>> 16) & 255) + 512]) ^ iArr3[(i14 >>> 24) + 768]) ^ iArr5[3];
i2 = i31;
}
int[] iArr6 = T;
int i32 = iArr6[i2 & 255];
int i33 = iArr6[((i4 >>> 8) & 255) + 256];
int i34 = iArr6[((i5 >>> 16) & 255) + 512];
int i35 = iArr6[(i6 >>> 24) + 768];
int[] iArr7 = iArr[i7];
int i36 = (((i32 ^ i33) ^ i34) ^ i35) ^ iArr7[0];
int i37 = (((iArr6[i4 & 255] ^ iArr6[((i5 >>> 8) & 255) + 256]) ^ iArr6[((i6 >>> 16) & 255) + 512]) ^ iArr6[(i2 >>> 24) + 768]) ^ iArr7[1];
int i38 = (((iArr6[i5 & 255] ^ iArr6[((i6 >>> 8) & 255) + 256]) ^ iArr6[((i2 >>> 16) & 255) + 512]) ^ iArr6[(i4 >>> 24) + 768]) ^ iArr7[2];
int i39 = (iArr6[(i5 >>> 24) + 768] ^ ((iArr6[((i2 >>> 8) & 255) + 256] ^ iArr6[i6 & 255]) ^ iArr6[((i4 >>> 16) & 255) + 512])) ^ iArr7[3];
byte[] bArr = S;
byte b = bArr[i36 & 255];
byte b2 = bArr[(i37 >>> 8) & 255];
byte b3 = bArr[(i38 >>> 16) & 255];
byte b4 = bArr[i39 >>> 24];
int[] iArr8 = iArr[i7 + 1];
this.C0 = ((((b & UnsignedBytes.MAX_VALUE) ^ ((b2 & UnsignedBytes.MAX_VALUE) << 8)) ^ ((b3 & UnsignedBytes.MAX_VALUE) << 16)) ^ ((b4 & UnsignedBytes.MAX_VALUE) << 24)) ^ iArr8[0];
this.C1 = ((((bArr[i37 & 255] & UnsignedBytes.MAX_VALUE) ^ ((bArr[(i38 >>> 8) & 255] & UnsignedBytes.MAX_VALUE) << 8)) ^ ((bArr[(i39 >>> 16) & 255] & UnsignedBytes.MAX_VALUE) << 16)) ^ ((bArr[i36 >>> 24] & UnsignedBytes.MAX_VALUE) << 24)) ^ iArr8[1];
this.C2 = ((((bArr[i38 & 255] & UnsignedBytes.MAX_VALUE) ^ ((bArr[(i39 >>> 8) & 255] & UnsignedBytes.MAX_VALUE) << 8)) ^ ((bArr[(i36 >>> 16) & 255] & UnsignedBytes.MAX_VALUE) << 16)) ^ ((bArr[i37 >>> 24] & UnsignedBytes.MAX_VALUE) << 24)) ^ iArr8[2];
this.C3 = ((((bArr[i39 & 255] & UnsignedBytes.MAX_VALUE) ^ ((bArr[(i36 >>> 8) & 255] & UnsignedBytes.MAX_VALUE) << 8)) ^ ((bArr[(i37 >>> 16) & 255] & UnsignedBytes.MAX_VALUE) << 16)) ^ ((bArr[i38 >>> 24] & UnsignedBytes.MAX_VALUE) << 24)) ^ iArr8[3];
}
private void decryptBlock(int[][] iArr) {
int i = this.C0;
int i2 = this.ROUNDS;
int[] iArr2 = iArr[i2];
char c = 0;
int i3 = i ^ iArr2[0];
int i4 = 1;
int i5 = this.C1 ^ iArr2[1];
char c2 = 2;
int i6 = this.C2 ^ iArr2[2];
int i7 = i2 - 1;
char c3 = 3;
int i8 = iArr2[3] ^ this.C3;
while (i7 > i4) {
int[] iArr3 = Tinv;
int i9 = iArr3[i3 & 255];
int i10 = iArr3[((i8 >>> 8) & 255) + 256];
int i11 = iArr3[((i6 >>> 16) & 255) + 512];
int i12 = iArr3[(i5 >>> 24) + 768];
int[] iArr4 = iArr[i7];
int i13 = (((i9 ^ i10) ^ i11) ^ i12) ^ iArr4[c];
int i14 = (((iArr3[i5 & 255] ^ iArr3[((i3 >>> 8) & 255) + 256]) ^ iArr3[((i8 >>> 16) & 255) + 512]) ^ iArr3[(i6 >>> 24) + 768]) ^ iArr4[i4];
int i15 = (((iArr3[i6 & 255] ^ iArr3[((i5 >>> 8) & 255) + 256]) ^ iArr3[((i3 >>> 16) & 255) + 512]) ^ iArr3[(i8 >>> 24) + 768]) ^ iArr4[c2];
int i16 = (iArr3[(i3 >>> 24) + 768] ^ ((iArr3[i8 & 255] ^ iArr3[((i6 >>> 8) & 255) + 256]) ^ iArr3[((i5 >>> 16) & 255) + 512])) ^ iArr4[c3];
int i17 = iArr3[i13 & 255];
int i18 = iArr3[((i16 >>> 8) & 255) + 256];
int i19 = iArr3[((i15 >>> 16) & 255) + 512];
int i20 = iArr3[(i14 >>> 24) + 768];
int[] iArr5 = iArr[i7 - 1];
int i21 = iArr5[c];
int i22 = iArr3[i14 & 255];
int i23 = iArr3[((i13 >>> 8) & 255) + 256];
int i24 = iArr3[((i16 >>> 16) & 255) + 512];
int i25 = iArr3[(i15 >>> 24) + 768];
int i26 = iArr5[1];
int i27 = iArr3[i15 & 255];
int i28 = iArr3[((i14 >>> 8) & 255) + 256];
int i29 = iArr3[((i13 >>> 16) & 255) + 512];
int i30 = iArr3[(i16 >>> 24) + 768];
int i31 = iArr5[2];
int i32 = iArr3[i16 & 255];
int i33 = iArr3[((i15 >>> 8) & 255) + 256];
i7 -= 2;
int i34 = (((i17 ^ i18) ^ i19) ^ i20) ^ i21;
i5 = (((i22 ^ i23) ^ i24) ^ i25) ^ i26;
i6 = (i30 ^ ((i28 ^ i27) ^ i29)) ^ i31;
c = 0;
i4 = 1;
c2 = 2;
c3 = 3;
i8 = (((i32 ^ i33) ^ iArr3[((i14 >>> 16) & 255) + 512]) ^ iArr3[(i13 >>> 24) + 768]) ^ iArr5[3];
i3 = i34;
}
int[] iArr6 = Tinv;
int i35 = iArr6[i3 & 255];
int i36 = iArr6[((i8 >>> 8) & 255) + 256];
int i37 = iArr6[((i6 >>> 16) & 255) + 512];
int i38 = iArr6[(i5 >>> 24) + 768];
int[] iArr7 = iArr[1];
int i39 = (((i35 ^ i36) ^ i37) ^ i38) ^ iArr7[0];
int i40 = (((iArr6[i5 & 255] ^ iArr6[((i3 >>> 8) & 255) + 256]) ^ iArr6[((i8 >>> 16) & 255) + 512]) ^ iArr6[(i6 >>> 24) + 768]) ^ iArr7[1];
int i41 = (((iArr6[i6 & 255] ^ iArr6[((i5 >>> 8) & 255) + 256]) ^ iArr6[((i3 >>> 16) & 255) + 512]) ^ iArr6[(i8 >>> 24) + 768]) ^ iArr7[2];
int i42 = (iArr6[(i3 >>> 24) + 768] ^ ((iArr6[i8 & 255] ^ iArr6[((i6 >>> 8) & 255) + 256]) ^ iArr6[((i5 >>> 16) & 255) + 512])) ^ iArr7[3];
byte[] bArr = Si;
byte b = bArr[i39 & 255];
byte b2 = bArr[(i42 >>> 8) & 255];
byte b3 = bArr[(i41 >>> 16) & 255];
byte b4 = bArr[i40 >>> 24];
int[] iArr8 = iArr[0];
this.C0 = ((((b & UnsignedBytes.MAX_VALUE) ^ ((b2 & UnsignedBytes.MAX_VALUE) << 8)) ^ ((b3 & UnsignedBytes.MAX_VALUE) << 16)) ^ ((b4 & UnsignedBytes.MAX_VALUE) << 24)) ^ iArr8[0];
this.C1 = ((((bArr[i40 & 255] & UnsignedBytes.MAX_VALUE) ^ ((bArr[(i39 >>> 8) & 255] & UnsignedBytes.MAX_VALUE) << 8)) ^ ((bArr[(i42 >>> 16) & 255] & UnsignedBytes.MAX_VALUE) << 16)) ^ ((bArr[i41 >>> 24] & UnsignedBytes.MAX_VALUE) << 24)) ^ iArr8[1];
this.C2 = ((((bArr[i41 & 255] & UnsignedBytes.MAX_VALUE) ^ ((bArr[(i40 >>> 8) & 255] & UnsignedBytes.MAX_VALUE) << 8)) ^ ((bArr[(i39 >>> 16) & 255] & UnsignedBytes.MAX_VALUE) << 16)) ^ ((bArr[i42 >>> 24] & UnsignedBytes.MAX_VALUE) << 24)) ^ iArr8[2];
this.C3 = ((((bArr[i42 & 255] & UnsignedBytes.MAX_VALUE) ^ ((bArr[(i41 >>> 8) & 255] & UnsignedBytes.MAX_VALUE) << 8)) ^ ((bArr[(i40 >>> 16) & 255] & UnsignedBytes.MAX_VALUE) << 16)) ^ ((bArr[i39 >>> 24] & UnsignedBytes.MAX_VALUE) << 24)) ^ iArr8[3];
}
static {
int[] iArr = new int[1024];
ByteBuffer.wrap("¥ccÆ\u0084||ø\u0099wwî\u008d{{ö\ròòÿ½kkÖ±ooÞTÅÅ\u0091P00`\u0003\u0001\u0001\u0002©ggÎ}++V\u0019þþçb×׵櫫M\u009avvìEÊÊ\u008f\u009d\u0082\u0082\u001f@ÉÉ\u0089\u0087}}ú\u0015úúïëYY²ÉGG\u008e\u000bððûì\u00ad\u00adAgÔÔ³ý¢¢_꯯E¿\u009c\u009c#÷¤¤S\u0096rrä[ÀÀ\u009b··u\u001cýýá®\u0093\u0093=j&&LZ66lA??~\u0002÷÷õOÌÌ\u0083\\44hô¥¥Q4ååÑ\bññù\u0093qqâsØØ«S11b?\u0015\u0015*\f\u0004\u0004\bRÇÇ\u0095e##F^ÃÃ\u009d(\u0018\u00180¡\u0096\u00967\u000f\u0005\u0005\\u009a\u009a/\t\u0007\u0007\u000e6\u0012\u0012$\u009b\u0080\u0080\u001b=ââß&ëëÍi''NͲ²\u007f\u009fuuê\u001b\t\t\u0012\u009e\u0083\u0083\u001dt,,X.\u001a\u001a4-\u001b\u001b6²nnÜîZZ´û  [öRR¤M;;vaÖַγ³}{))R>ããÝq//^\u0097\u0084\u0084\u0013õSS¦hÑѹ\u0000\u0000\u0000\u0000,ííÁ` @\u001füüãȱ±yí[[¶¾jjÔFËË\u008dÙ¾¾gK99rÞJJ\u0094ÔLL\u0098èXX°JÏÏ\u0085kÐл*ïïÅ媪O\u0016ûûíÅCC\u0086×MM\u009aU33f\u0094\u0085\u0085\u0011ÏEE\u008a\u0010ùùé\u0006\u0002\u0002\u0004\u0081\u007f\u007fþðPP D<<xº\u009f\u009f%㨨KóQQ¢þ££]À@@\u0080\u008a\u008f\u008f\u0005\u00ad\u0092\u0092?¼\u009d\u009d!H88p\u0004õõñß¼¼cÁ¶¶wuÚÚ¯c!!B0\u0010\u0010 \u001aÿÿå\u000eóóýmÒÒ¿LÍÍ\u0081\u0014\f\f\u00185\u0013\u0013&/ììÃá__¾¢\u0097\u00975ÌDD\u00889\u0017\u0017.WÄÄ\u0093ò§§U\u0082~~üG==z¬ddÈç]]º+\u0019\u00192\u0095ssæ ``À\u0098\u0081\u0081\u0019ÑOO\u009e\u007fÜÜ£f\"\"D~**T«\u0090\u0090;\u0083\u0088\u0088\u000bÊFF\u008c)îîÇÓ¸¸k<\u0014\u0014(yÞÞ§â^^¼\u001d\u000b\u000b\u0016vÛÛ\u00ad;ààÛV22dN::t\u001e\n\n\u0014ÛII\u0092\n\u0006\u0006\fl$$Hä\\\\¸]ÂÂ\u009fnÓӽשּׁC¦bbĨ\u0091\u00919¤\u0095\u009517ääÓ\u008byyò2ççÕCÈÈ\u008bY77n·mmÚ\u008c\u008d\u008d\u0001dÕÕ±ÒNN\u009cà©©I´llØúVV¬\u0007ôôó%êêϯeeÊ\u008ezzôé®®G\u0018\b\b\u0010Õººo\u0088xxðo%%Jr..\\$\u001c\u001c8ñ¦¦WÇ´´sQÆÆ\u0097#èèË|ÝÝ¡\u009cttè!\u001f\u001f>ÝKK\u0096ܽ½a\u0086\u008b\u008b\r\u0085\u008a\u008a\u000f\u0090ppàB>>|ĵµqªffÌØHH\u0090\u0005\u0003\u0003\u0006\u0001öö÷\u0012\u000e\u000e\u001c£aaÂ_55jùWW®Ð¹¹i\u0091\u0086\u0086\u0017XÁÁ\u0099'\u001d\u001d:¹\u009e\u009e'8ááÙ\u0013øøë³\u0098\u0098+3\u0011\u0011\"»iiÒpÙÙ©\u0089\u008e\u008e\u0007§\u0094\u00943¶\u009b\u009b-\"\u001e\u001e<\u0092\u0087\u0087\u0015 ééÉIÎÎ\u0087ÿUUªx((Pzßߥ\u008f\u008c\u008c\u0003ø¡¡Y\u0080\u0089\u0089\t\u0017\r\r\u001aÚ¿¿e1ææ×ÆBB\u0084¸hhÐÃAA\u0082°\u0099\u0099)w--Z\u0011\u000f\u000f\u001eË°°{üTT¨Ö»»m:\u0016\u0016,ccÆ¥||ø\u0084wwî\u0099{{ö\u008dòòÿ\rkkÖ½ooÞ±ÅÅ\u0091T00`P\u0001\u0001\u0002\u0003ggΩ++V}þþç\u0019××µb««Mævvì\u009aÊÊ\u008fE\u0082\u0082\u001f\u009dÉÉ\u0089@}}ú\u0087úúï\u0015YY²ëGG\u008eÉððû\u000b\u00ad\u00adAìÔÔ³g¢¢_ý¯¯Eê\u009c\u009c#¿¤¤S÷rrä\u0096ÀÀ\u009b[··uÂýýá\u001c\u0093\u0093=®&&Lj66lZ??~A÷÷õ\u0002ÌÌ\u0083O44h\\¥¥QôååÑ4ññù\bqqâ\u0093ØØ«s11bS\u0015\u0015*?\u0004\u0004\b\fÇÇ\u0095R##FeÃÃ\u009d^\u0018\u00180(\u0096\u00967¡\u0005\u0005\n\u000f\u009a\u009a/µ\u0007\u0007\u000e\t\u0012\u0012$6\u0080\u0080\u001b\u009bââß=ëëÍ&''Ni²²\u007fÍuuê\u009f\t\t\u0012\u001b\u0083\u0083\u001d\u009e,,Xt\u001a\u001a4.\u001b\u001b6-nnܲZZ´î  [ûRR¤ö;;vMÖÖ·a³³}Î))R{ããÝ>//^q\u0084\u0084\u0013\u0097SS¦õÑѹh\u0000\u0000\u0000\u0000ííÁ, @`üüã\u001f±±yÈ[[¶íjjÔ¾ËË\u008dF¾¾gÙ99rKJJ\u0094ÞLL\u0098ÔXX°èÏÏ\u0085JÐлkïïÅ*ªªOåûûí\u0016CC\u0086ÅMM\u009a×33fU\u0085\u0085\u0011\u0094EE\u008aÏùùé\u0010\u0002\u0002\u0004\u0006\u007f\u007fþ\u0081PP ð<<xD\u009f\u009f%º¨¨KãQQ¢ó££]þ@@\u0080À\u008f\u008f\u0005\u008a\u0092\u0092?\u00ad\u009d\u009d!¼88pHõõñ\u0004¼¼c߶¶wÁÚÚ¯u!!Bc\u0010\u0010 0ÿÿå\u001aóóý\u000eÒÒ¿mÍÍ\u0081L\f\f\u0018\u0014\u0013\u0013&5ììÃ/__¾á\u0097\u00975¢DD\u0088Ì\u0017\u0017.9ÄÄ\u0093W§§Uò~~ü\u0082==zGddÈ
T = iArr;
int[] iArr2 = new int[1024];
ByteBuffer.wrap("P§ôQSeA~ä\u0017\u001a\u0096^':Ëk«;ñE\u009d\u001f«Xú¬\u0093\u0003ãKUú0 ömv\u00ad\u0091vÌ\u0088%L\u0002õü×åO×Ë*Å\u0080D5&\u008f£bµIZ±Þg\u001bº%\u0098\u000eêEáÀþ]\u0002u/Ã\u0012ðL\u0081£\u0097F\u008dÆùÓkç_\u008f\u0003\u0095\u009c\u0092\u0015ëzm¿ÚYR\u0095-\u0083¾ÔÓ!tX)iàIDÈÉ\u008ej\u0089Âuxy\u008eôk>X\u0099Ýq¹'¶Oá¾\u0017\u00ad\u0088ðf¬ É´:Î}\u0018Jßc\u00821\u001aå`3Q\u0097E\u007fSbàwd±\u0084®k»\u001c \u0081þ\u0094+\bùXhHp\u0019ýE\u008f\u0087lÞ\u0094·ø{R#Ós«â\u0002KrW\u008f\u001fã*«Uf\u0007(ë²\u0003µ/\u009a{Å\u0086¥\b7Óò\u0087(0²¥¿#ºj\u0003\u0002\\\u0082\u0016í+\u001cÏ\u008a\u0092´y§ðò\u0007ó¡âiNÍôÚeÕ¾\u0005\u0006\u001fb4Ñ\u008aþ¦Ä\u009dS.4 Uó¢2á\u008a\u0005uëö¤9ì\u0083\u000bªï`@\u0006\u009fq^Q\u0010n½ù\u008a!>=\u0006Ý\u0096®\u0005>ÝF½æMµ\u008dT\u0091\u0005]ÄqoÔ\u0006\u0004ÿ\u0015P`$û\u0098\u0019\u0097é½ÖÌC@\u0089w\u009eÙg½Bè°\u0088\u008b\u0089\u00078[\u0019çÛîÈyG\n|¡é\u000fB|É\u001e\u0084ø\u0000\u0000\u0000\u0000\u0083\u0086\u0080\tHí+2¬p\u0011\u001eNrZlûÿ\u000eýV8\u0085\u000f\u001eÕ®='9-6dÙ\u000f\n!¦\\hÑT[\u009b:.6$±g\n\f\u000fçW\u0093Ò\u0096î´\u009e\u0091\u009b\u001bOÅÀ\u0080¢ ÜaiKwZ\u0016\u001a\u0012\u001c\\u0093âå* ÀCà\"<\u001d\u0017\u001b\u0012\u000b\r\t\u000e\u00adÇ\u008bò¹¨¶-È©\u001e\u0014\u0085\u0019ñWL\u0007u¯»Ý\u0099îý`\u007f£\u009f&\u0001÷¼õr\\Å;fD4~û[v)C\u008bÜÆ#Ëhüí¶cñä¸ÊÜ1×\u0010\u0085cB@\"\u0097\u0013 \u0011Æ\u0084}$J\u0085ø=»Ò\u00112ù®m¡)ÇK/\u009e\u001dó0²ÜìR\u0086\rÐãÁwl\u0016³+\u0099¹p©úH\u0094\u0011\"déGÄ\u008cü¨\u001a?ð Ø,}Vï\u00903\"ÇNI\u0087ÁÑ8Ùþ¢Ê\u008c6\u000bÔ\u0098Ï\u0081õ¦(Þz¥&\u008e·Ú¤¿\u00ad?ä\u009d:,\r\u0092xP\u009bÌ_jbF~TÂ\u0013\u008döè¸Ø\u0090^÷9.õ¯Ã\u0082¾\u0080]\u009f|\u0093Ði©-Õo³\u0012%Ï;\u0099¬È§}\u0018\u0010nc\u009cè{»;Û\tx&Íô\u0018Yn\u0001·\u009aì¨\u009aO\u0083en\u0095æ~æÿª\bϼ!æè\u0015ïÙ\u009bçºÎ6oJÔ\t\u009fêÖ|°)¯²¤11#?*0\u0094¥ÆÀf¢57¼Nt¦Ê\u0082ü°Ð\u0090à\u0015ا3J\u0098\u0004ñ÷ÚìA\u000ePÍ\u007f/ö\u0091\u0017\u008dÖMvM°ïCTMªÌß\u0004\u0096äãµÑ\u009e\u001b\u0088jL¸\u001f,Á\u007fQeF\u0004ê^\u009d]5\u008c\u0001st\u0087ú.A\u000bûZ\u001dg³RÒÛ\u00923V\u0010é\u0013GÖm\u008ca×\u009az\f¡7\u008e\u0014øY\u0089<\u0013ëî'©Î5Éa·íå\u001cá<±GzYßÒ\u009c?sòUyÎ\u0014\u0018¿7ÇsêÍ÷S[ªý_\u0014o=ß\u0086ÛDx\u0081ó¯Ê>Äh¹,4$8_@£ÂrÃ\u001d\u0016\f%â¼\u008bI<(A\u0095\rÿq\u0001¨9Þ³\f\b\u009cä´Ø\u0090ÁVda\u0084Ë{p¶2Õt\\lHBW¸Ð§ôQPeA~S¤\u0017\u001aÃ^':\u0096k«;ËE\u009d\u001fñXú¬«\u0003ãK\u0093ú0 Umv\u00adövÌ\u0088\u0091L\u0002õ%×åOüË*Å×D5&\u0080£bµ\u008fZ±ÞI\u001bº%g\u000eêE\u0098Àþ]áu/Ã\u0002ðL\u0081\u0012\u0097F\u008d£ùÓkÆ_\u008f\u0003ç\u009c\u0092\u0015\u0095zm¿ëYR\u0095Ú\u0083¾Ô-!tXÓiàI)ÈÉ\u008eD\u0089Âujy\u008eôx>X\u0099kq¹'ÝOᾶ\u00ad\u0088ð\u0017¬ Éf:Î}´Jßc\u00181\u001aå\u00823Q\u0097`\u007fSbEwd±à®k»\u0084 \u0081þ\u001c+\\u0094hHpXýE\u008f\u0019lÞ\u0094\u0087ø{R·Ós«#\u0002Krâ\u008f\u001fãW«Uf*(ë²\u0007µ/\u0003{Å\u0086\u009a\b7Ó¥\u0087(0ò¥¿#²j\u0003\u0002º\u0082\u0016í\\\u001cÏ\u008a+´\u0092ò\u0007óðâiN¡ôÚe;\u0005\u0006Õb4Ñ\u001fþ¦Ä\u008aS.4\u009dUó¢ á\u008a\u00052ëö¤uì\u0083\u000b9ï`@ª\u009fq^\u0006\u0010n½Q\u008a!>ù\u0006Ý\u0096=\u0005>Ý®½æMF\u008dT\u0091µ]Äq\u0005Ô\u0006\u0004o\u0015P`ÿû\u0098\u0019$é½Ö\u0097C@\u0089Ì\u009eÙgwBè°½\u008b\u0089\u0007\u0088[\u0019ç8îÈyÛ\n|¡G\u000fB|é\u001e\u0084øÉ\u0000\u0000\u0000\u0000\u0086\u0080\t\u0083í+2Hp\u0011\u001e¬rZlNÿ\u000eýû8\u0085\u000fVÕ®=\u001e9-6'Ù\u000f\nd¦\\h!T[\u009bÑ.6$:g\n\f±çW\u0093\u000f\u0096î´Ò\u0091\u009b\u001b\u009eÅÀ\u0080O Üa¢KwZi\u001a\u0012\u001c\u0016º\u0093â\n* Àåà\"<C\u0017\u001b\u0012\u001d\r\t\u000e\u000bÇ\u008bò\u00ad¨¶-¹©\u001e\u0014È\u0019ñW\u0085\u0007u¯LÝ
Tinv = iArr2;
}
}