Beispiel #1
0
        protected override int[] MakeWorkingKey(byte[] key)
        {
            //IL_004c: Unknown result type (might be due to invalid IL or missing references)
            int[] array = new int[16];
            int   num   = 0;
            int   num2  = 0;

            for (num = 0; num + 4 < key.Length; num += 4)
            {
                array[num2++] = (int)Pack.LE_To_UInt32(key, num);
            }
            if (num % 4 == 0)
            {
                array[num2++] = (int)Pack.LE_To_UInt32(key, num);
                if (num2 < 8)
                {
                    array[num2] = 1;
                }
                int   num3   = 132;
                int[] array2 = new int[num3];
                for (int i = 8; i < 16; i++)
                {
                    array[i] = SerpentEngineBase.RotateLeft(array[i - 8] ^ array[i - 5] ^ array[i - 3] ^ array[i - 1] ^ -1640531527 ^ (i - 8), 11);
                }
                global::System.Array.Copy((global::System.Array)array, 8, (global::System.Array)array2, 0, 8);
                for (int j = 8; j < num3; j++)
                {
                    array2[j] = SerpentEngineBase.RotateLeft(array2[j - 8] ^ array2[j - 5] ^ array2[j - 3] ^ array2[j - 1] ^ -1640531527 ^ j, 11);
                }
                Sb3(array2[0], array2[1], array2[2], array2[3]);
                array2[0] = X0;
                array2[1] = X1;
                array2[2] = X2;
                array2[3] = X3;
                Sb2(array2[4], array2[5], array2[6], array2[7]);
                array2[4] = X0;
                array2[5] = X1;
                array2[6] = X2;
                array2[7] = X3;
                Sb1(array2[8], array2[9], array2[10], array2[11]);
                array2[8]  = X0;
                array2[9]  = X1;
                array2[10] = X2;
                array2[11] = X3;
                Sb0(array2[12], array2[13], array2[14], array2[15]);
                array2[12] = X0;
                array2[13] = X1;
                array2[14] = X2;
                array2[15] = X3;
                Sb7(array2[16], array2[17], array2[18], array2[19]);
                array2[16] = X0;
                array2[17] = X1;
                array2[18] = X2;
                array2[19] = X3;
                Sb6(array2[20], array2[21], array2[22], array2[23]);
                array2[20] = X0;
                array2[21] = X1;
                array2[22] = X2;
                array2[23] = X3;
                Sb5(array2[24], array2[25], array2[26], array2[27]);
                array2[24] = X0;
                array2[25] = X1;
                array2[26] = X2;
                array2[27] = X3;
                Sb4(array2[28], array2[29], array2[30], array2[31]);
                array2[28] = X0;
                array2[29] = X1;
                array2[30] = X2;
                array2[31] = X3;
                Sb3(array2[32], array2[33], array2[34], array2[35]);
                array2[32] = X0;
                array2[33] = X1;
                array2[34] = X2;
                array2[35] = X3;
                Sb2(array2[36], array2[37], array2[38], array2[39]);
                array2[36] = X0;
                array2[37] = X1;
                array2[38] = X2;
                array2[39] = X3;
                Sb1(array2[40], array2[41], array2[42], array2[43]);
                array2[40] = X0;
                array2[41] = X1;
                array2[42] = X2;
                array2[43] = X3;
                Sb0(array2[44], array2[45], array2[46], array2[47]);
                array2[44] = X0;
                array2[45] = X1;
                array2[46] = X2;
                array2[47] = X3;
                Sb7(array2[48], array2[49], array2[50], array2[51]);
                array2[48] = X0;
                array2[49] = X1;
                array2[50] = X2;
                array2[51] = X3;
                Sb6(array2[52], array2[53], array2[54], array2[55]);
                array2[52] = X0;
                array2[53] = X1;
                array2[54] = X2;
                array2[55] = X3;
                Sb5(array2[56], array2[57], array2[58], array2[59]);
                array2[56] = X0;
                array2[57] = X1;
                array2[58] = X2;
                array2[59] = X3;
                Sb4(array2[60], array2[61], array2[62], array2[63]);
                array2[60] = X0;
                array2[61] = X1;
                array2[62] = X2;
                array2[63] = X3;
                Sb3(array2[64], array2[65], array2[66], array2[67]);
                array2[64] = X0;
                array2[65] = X1;
                array2[66] = X2;
                array2[67] = X3;
                Sb2(array2[68], array2[69], array2[70], array2[71]);
                array2[68] = X0;
                array2[69] = X1;
                array2[70] = X2;
                array2[71] = X3;
                Sb1(array2[72], array2[73], array2[74], array2[75]);
                array2[72] = X0;
                array2[73] = X1;
                array2[74] = X2;
                array2[75] = X3;
                Sb0(array2[76], array2[77], array2[78], array2[79]);
                array2[76] = X0;
                array2[77] = X1;
                array2[78] = X2;
                array2[79] = X3;
                Sb7(array2[80], array2[81], array2[82], array2[83]);
                array2[80] = X0;
                array2[81] = X1;
                array2[82] = X2;
                array2[83] = X3;
                Sb6(array2[84], array2[85], array2[86], array2[87]);
                array2[84] = X0;
                array2[85] = X1;
                array2[86] = X2;
                array2[87] = X3;
                Sb5(array2[88], array2[89], array2[90], array2[91]);
                array2[88] = X0;
                array2[89] = X1;
                array2[90] = X2;
                array2[91] = X3;
                Sb4(array2[92], array2[93], array2[94], array2[95]);
                array2[92] = X0;
                array2[93] = X1;
                array2[94] = X2;
                array2[95] = X3;
                Sb3(array2[96], array2[97], array2[98], array2[99]);
                array2[96] = X0;
                array2[97] = X1;
                array2[98] = X2;
                array2[99] = X3;
                Sb2(array2[100], array2[101], array2[102], array2[103]);
                array2[100] = X0;
                array2[101] = X1;
                array2[102] = X2;
                array2[103] = X3;
                Sb1(array2[104], array2[105], array2[106], array2[107]);
                array2[104] = X0;
                array2[105] = X1;
                array2[106] = X2;
                array2[107] = X3;
                Sb0(array2[108], array2[109], array2[110], array2[111]);
                array2[108] = X0;
                array2[109] = X1;
                array2[110] = X2;
                array2[111] = X3;
                Sb7(array2[112], array2[113], array2[114], array2[115]);
                array2[112] = X0;
                array2[113] = X1;
                array2[114] = X2;
                array2[115] = X3;
                Sb6(array2[116], array2[117], array2[118], array2[119]);
                array2[116] = X0;
                array2[117] = X1;
                array2[118] = X2;
                array2[119] = X3;
                Sb5(array2[120], array2[121], array2[122], array2[123]);
                array2[120] = X0;
                array2[121] = X1;
                array2[122] = X2;
                array2[123] = X3;
                Sb4(array2[124], array2[125], array2[126], array2[127]);
                array2[124] = X0;
                array2[125] = X1;
                array2[126] = X2;
                array2[127] = X3;
                Sb3(array2[128], array2[129], array2[130], array2[131]);
                array2[128] = X0;
                array2[129] = X1;
                array2[130] = X2;
                array2[131] = X3;
                return(array2);
            }
            throw new ArgumentException("key must be a multiple of 4 bytes");
        }
Beispiel #2
0
        protected override int[] MakeWorkingKey(byte[] key)
        {
            int[] sourceArray = new int[0x10];
            int   off         = 0;
            int   index       = 0;

            off = 0;
            while ((off + 4) < key.Length)
            {
                sourceArray[index++] = (int)Pack.LE_To_UInt32(key, off);
                off += 4;
            }
            if ((off % 4) != 0)
            {
                throw new ArgumentException("key must be a multiple of 4 bytes");
            }
            sourceArray[index++] = (int)Pack.LE_To_UInt32(key, off);
            if (index < 8)
            {
                sourceArray[index] = 1;
            }
            int num3 = 0x84;

            int[] destinationArray = new int[num3];
            for (int i = 8; i < 0x10; i++)
            {
                sourceArray[i] = SerpentEngineBase.RotateLeft(((((sourceArray[i - 8] ^ sourceArray[i - 5]) ^ sourceArray[i - 3]) ^ sourceArray[i - 1]) ^ -1640531527) ^ (i - 8), 11);
            }
            Array.Copy(sourceArray, 8, destinationArray, 0, 8);
            for (int j = 8; j < num3; j++)
            {
                destinationArray[j] = SerpentEngineBase.RotateLeft(((((destinationArray[j - 8] ^ destinationArray[j - 5]) ^ destinationArray[j - 3]) ^ destinationArray[j - 1]) ^ -1640531527) ^ j, 11);
            }
            base.Sb3(destinationArray[0], destinationArray[1], destinationArray[2], destinationArray[3]);
            destinationArray[0] = base.X0;
            destinationArray[1] = base.X1;
            destinationArray[2] = base.X2;
            destinationArray[3] = base.X3;
            base.Sb2(destinationArray[4], destinationArray[5], destinationArray[6], destinationArray[7]);
            destinationArray[4] = base.X0;
            destinationArray[5] = base.X1;
            destinationArray[6] = base.X2;
            destinationArray[7] = base.X3;
            base.Sb1(destinationArray[8], destinationArray[9], destinationArray[10], destinationArray[11]);
            destinationArray[8]  = base.X0;
            destinationArray[9]  = base.X1;
            destinationArray[10] = base.X2;
            destinationArray[11] = base.X3;
            base.Sb0(destinationArray[12], destinationArray[13], destinationArray[14], destinationArray[15]);
            destinationArray[12] = base.X0;
            destinationArray[13] = base.X1;
            destinationArray[14] = base.X2;
            destinationArray[15] = base.X3;
            base.Sb7(destinationArray[0x10], destinationArray[0x11], destinationArray[0x12], destinationArray[0x13]);
            destinationArray[0x10] = base.X0;
            destinationArray[0x11] = base.X1;
            destinationArray[0x12] = base.X2;
            destinationArray[0x13] = base.X3;
            base.Sb6(destinationArray[20], destinationArray[0x15], destinationArray[0x16], destinationArray[0x17]);
            destinationArray[20]   = base.X0;
            destinationArray[0x15] = base.X1;
            destinationArray[0x16] = base.X2;
            destinationArray[0x17] = base.X3;
            base.Sb5(destinationArray[0x18], destinationArray[0x19], destinationArray[0x1a], destinationArray[0x1b]);
            destinationArray[0x18] = base.X0;
            destinationArray[0x19] = base.X1;
            destinationArray[0x1a] = base.X2;
            destinationArray[0x1b] = base.X3;
            base.Sb4(destinationArray[0x1c], destinationArray[0x1d], destinationArray[30], destinationArray[0x1f]);
            destinationArray[0x1c] = base.X0;
            destinationArray[0x1d] = base.X1;
            destinationArray[30]   = base.X2;
            destinationArray[0x1f] = base.X3;
            base.Sb3(destinationArray[0x20], destinationArray[0x21], destinationArray[0x22], destinationArray[0x23]);
            destinationArray[0x20] = base.X0;
            destinationArray[0x21] = base.X1;
            destinationArray[0x22] = base.X2;
            destinationArray[0x23] = base.X3;
            base.Sb2(destinationArray[0x24], destinationArray[0x25], destinationArray[0x26], destinationArray[0x27]);
            destinationArray[0x24] = base.X0;
            destinationArray[0x25] = base.X1;
            destinationArray[0x26] = base.X2;
            destinationArray[0x27] = base.X3;
            base.Sb1(destinationArray[40], destinationArray[0x29], destinationArray[0x2a], destinationArray[0x2b]);
            destinationArray[40]   = base.X0;
            destinationArray[0x29] = base.X1;
            destinationArray[0x2a] = base.X2;
            destinationArray[0x2b] = base.X3;
            base.Sb0(destinationArray[0x2c], destinationArray[0x2d], destinationArray[0x2e], destinationArray[0x2f]);
            destinationArray[0x2c] = base.X0;
            destinationArray[0x2d] = base.X1;
            destinationArray[0x2e] = base.X2;
            destinationArray[0x2f] = base.X3;
            base.Sb7(destinationArray[0x30], destinationArray[0x31], destinationArray[50], destinationArray[0x33]);
            destinationArray[0x30] = base.X0;
            destinationArray[0x31] = base.X1;
            destinationArray[50]   = base.X2;
            destinationArray[0x33] = base.X3;
            base.Sb6(destinationArray[0x34], destinationArray[0x35], destinationArray[0x36], destinationArray[0x37]);
            destinationArray[0x34] = base.X0;
            destinationArray[0x35] = base.X1;
            destinationArray[0x36] = base.X2;
            destinationArray[0x37] = base.X3;
            base.Sb5(destinationArray[0x38], destinationArray[0x39], destinationArray[0x3a], destinationArray[0x3b]);
            destinationArray[0x38] = base.X0;
            destinationArray[0x39] = base.X1;
            destinationArray[0x3a] = base.X2;
            destinationArray[0x3b] = base.X3;
            base.Sb4(destinationArray[60], destinationArray[0x3d], destinationArray[0x3e], destinationArray[0x3f]);
            destinationArray[60]   = base.X0;
            destinationArray[0x3d] = base.X1;
            destinationArray[0x3e] = base.X2;
            destinationArray[0x3f] = base.X3;
            base.Sb3(destinationArray[0x40], destinationArray[0x41], destinationArray[0x42], destinationArray[0x43]);
            destinationArray[0x40] = base.X0;
            destinationArray[0x41] = base.X1;
            destinationArray[0x42] = base.X2;
            destinationArray[0x43] = base.X3;
            base.Sb2(destinationArray[0x44], destinationArray[0x45], destinationArray[70], destinationArray[0x47]);
            destinationArray[0x44] = base.X0;
            destinationArray[0x45] = base.X1;
            destinationArray[70]   = base.X2;
            destinationArray[0x47] = base.X3;
            base.Sb1(destinationArray[0x48], destinationArray[0x49], destinationArray[0x4a], destinationArray[0x4b]);
            destinationArray[0x48] = base.X0;
            destinationArray[0x49] = base.X1;
            destinationArray[0x4a] = base.X2;
            destinationArray[0x4b] = base.X3;
            base.Sb0(destinationArray[0x4c], destinationArray[0x4d], destinationArray[0x4e], destinationArray[0x4f]);
            destinationArray[0x4c] = base.X0;
            destinationArray[0x4d] = base.X1;
            destinationArray[0x4e] = base.X2;
            destinationArray[0x4f] = base.X3;
            base.Sb7(destinationArray[80], destinationArray[0x51], destinationArray[0x52], destinationArray[0x53]);
            destinationArray[80]   = base.X0;
            destinationArray[0x51] = base.X1;
            destinationArray[0x52] = base.X2;
            destinationArray[0x53] = base.X3;
            base.Sb6(destinationArray[0x54], destinationArray[0x55], destinationArray[0x56], destinationArray[0x57]);
            destinationArray[0x54] = base.X0;
            destinationArray[0x55] = base.X1;
            destinationArray[0x56] = base.X2;
            destinationArray[0x57] = base.X3;
            base.Sb5(destinationArray[0x58], destinationArray[0x59], destinationArray[90], destinationArray[0x5b]);
            destinationArray[0x58] = base.X0;
            destinationArray[0x59] = base.X1;
            destinationArray[90]   = base.X2;
            destinationArray[0x5b] = base.X3;
            base.Sb4(destinationArray[0x5c], destinationArray[0x5d], destinationArray[0x5e], destinationArray[0x5f]);
            destinationArray[0x5c] = base.X0;
            destinationArray[0x5d] = base.X1;
            destinationArray[0x5e] = base.X2;
            destinationArray[0x5f] = base.X3;
            base.Sb3(destinationArray[0x60], destinationArray[0x61], destinationArray[0x62], destinationArray[0x63]);
            destinationArray[0x60] = base.X0;
            destinationArray[0x61] = base.X1;
            destinationArray[0x62] = base.X2;
            destinationArray[0x63] = base.X3;
            base.Sb2(destinationArray[100], destinationArray[0x65], destinationArray[0x66], destinationArray[0x67]);
            destinationArray[100]  = base.X0;
            destinationArray[0x65] = base.X1;
            destinationArray[0x66] = base.X2;
            destinationArray[0x67] = base.X3;
            base.Sb1(destinationArray[0x68], destinationArray[0x69], destinationArray[0x6a], destinationArray[0x6b]);
            destinationArray[0x68] = base.X0;
            destinationArray[0x69] = base.X1;
            destinationArray[0x6a] = base.X2;
            destinationArray[0x6b] = base.X3;
            base.Sb0(destinationArray[0x6c], destinationArray[0x6d], destinationArray[110], destinationArray[0x6f]);
            destinationArray[0x6c] = base.X0;
            destinationArray[0x6d] = base.X1;
            destinationArray[110]  = base.X2;
            destinationArray[0x6f] = base.X3;
            base.Sb7(destinationArray[0x70], destinationArray[0x71], destinationArray[0x72], destinationArray[0x73]);
            destinationArray[0x70] = base.X0;
            destinationArray[0x71] = base.X1;
            destinationArray[0x72] = base.X2;
            destinationArray[0x73] = base.X3;
            base.Sb6(destinationArray[0x74], destinationArray[0x75], destinationArray[0x76], destinationArray[0x77]);
            destinationArray[0x74] = base.X0;
            destinationArray[0x75] = base.X1;
            destinationArray[0x76] = base.X2;
            destinationArray[0x77] = base.X3;
            base.Sb5(destinationArray[120], destinationArray[0x79], destinationArray[0x7a], destinationArray[0x7b]);
            destinationArray[120]  = base.X0;
            destinationArray[0x79] = base.X1;
            destinationArray[0x7a] = base.X2;
            destinationArray[0x7b] = base.X3;
            base.Sb4(destinationArray[0x7c], destinationArray[0x7d], destinationArray[0x7e], destinationArray[0x7f]);
            destinationArray[0x7c] = base.X0;
            destinationArray[0x7d] = base.X1;
            destinationArray[0x7e] = base.X2;
            destinationArray[0x7f] = base.X3;
            base.Sb3(destinationArray[0x80], destinationArray[0x81], destinationArray[130], destinationArray[0x83]);
            destinationArray[0x80] = base.X0;
            destinationArray[0x81] = base.X1;
            destinationArray[130]  = base.X2;
            destinationArray[0x83] = base.X3;
            return(destinationArray);
        }