private unsafe static void SHATransform(ulong *expandedBuffer, ulong *state, byte *block)
        {
            ulong num  = *state;
            ulong num2 = state[1];
            ulong num3 = state[2];
            ulong num4 = state[3];
            ulong num5 = state[4];
            ulong num6 = state[5];
            ulong num7 = state[6];
            ulong num8 = state[7];

            Utils.QuadWordFromBigEndian(expandedBuffer, 16, block);
            SHA384Managed.SHA384Expand(expandedBuffer);
            for (int i = 0; i < 80; i++)
            {
                ulong num9  = num8 + SHA384Managed.Sigma_1(num5) + SHA384Managed.Ch(num5, num6, num7) + SHA384Managed._K[i] + expandedBuffer[i];
                ulong num10 = num4 + num9;
                ulong num11 = num9 + SHA384Managed.Sigma_0(num) + SHA384Managed.Maj(num, num2, num3);
                i++;
                num9 = num7 + SHA384Managed.Sigma_1(num10) + SHA384Managed.Ch(num10, num5, num6) + SHA384Managed._K[i] + expandedBuffer[i];
                ulong num12 = num3 + num9;
                ulong num13 = num9 + SHA384Managed.Sigma_0(num11) + SHA384Managed.Maj(num11, num, num2);
                i++;
                num9 = num6 + SHA384Managed.Sigma_1(num12) + SHA384Managed.Ch(num12, num10, num5) + SHA384Managed._K[i] + expandedBuffer[i];
                ulong num14 = num2 + num9;
                ulong num15 = num9 + SHA384Managed.Sigma_0(num13) + SHA384Managed.Maj(num13, num11, num);
                i++;
                num9 = num5 + SHA384Managed.Sigma_1(num14) + SHA384Managed.Ch(num14, num12, num10) + SHA384Managed._K[i] + expandedBuffer[i];
                ulong num16 = num + num9;
                ulong num17 = num9 + SHA384Managed.Sigma_0(num15) + SHA384Managed.Maj(num15, num13, num11);
                i++;
                num9 = num10 + SHA384Managed.Sigma_1(num16) + SHA384Managed.Ch(num16, num14, num12) + SHA384Managed._K[i] + expandedBuffer[i];
                num8 = num11 + num9;
                num4 = num9 + SHA384Managed.Sigma_0(num17) + SHA384Managed.Maj(num17, num15, num13);
                i++;
                num9 = num12 + SHA384Managed.Sigma_1(num8) + SHA384Managed.Ch(num8, num16, num14) + SHA384Managed._K[i] + expandedBuffer[i];
                num7 = num13 + num9;
                num3 = num9 + SHA384Managed.Sigma_0(num4) + SHA384Managed.Maj(num4, num17, num15);
                i++;
                num9 = num14 + SHA384Managed.Sigma_1(num7) + SHA384Managed.Ch(num7, num8, num16) + SHA384Managed._K[i] + expandedBuffer[i];
                num6 = num15 + num9;
                num2 = num9 + SHA384Managed.Sigma_0(num3) + SHA384Managed.Maj(num3, num4, num17);
                i++;
                num9 = num16 + SHA384Managed.Sigma_1(num6) + SHA384Managed.Ch(num6, num7, num8) + SHA384Managed._K[i] + expandedBuffer[i];
                num5 = num17 + num9;
                num  = num9 + SHA384Managed.Sigma_0(num2) + SHA384Managed.Maj(num2, num3, num4);
            }
            *state += num;
            state[1] += num2;
            state[2] += num3;
            state[3] += num4;
            state[4] += num5;
            state[5] += num6;
            state[6] += num7;
            state[7] += num8;
        }
Exemple #2
0
        private static unsafe void SHATransform(ulong *expandedBuffer, ulong *state, byte *block)
        {
            ulong num1 = *state;
            ulong num2 = (ulong)*(long *)((IntPtr)state + 8);
            ulong num3 = state[2];
            ulong num4 = state[3];
            ulong num5 = state[4];
            ulong num6 = state[5];
            ulong num7 = state[6];
            ulong num8 = state[7];

            Utils.QuadWordFromBigEndian(expandedBuffer, 16, block);
            SHA384Managed.SHA384Expand(expandedBuffer);
            int index1;

            for (int index2 = 0; index2 < 80; index2 = index1 + 1)
            {
                ulong num9   = num8 + SHA384Managed.Sigma_1(num5) + SHA384Managed.Ch(num5, num6, num7) + SHA384Managed._K[index2] + expandedBuffer[index2];
                ulong num10  = num4 + num9;
                ulong num11  = num9 + SHA384Managed.Sigma_0(num1) + SHA384Managed.Maj(num1, num2, num3);
                int   index3 = index2 + 1;
                ulong num12  = num7 + SHA384Managed.Sigma_1(num10) + SHA384Managed.Ch(num10, num5, num6) + SHA384Managed._K[index3] + expandedBuffer[index3];
                ulong num13  = num3 + num12;
                ulong num14  = num12 + SHA384Managed.Sigma_0(num11) + SHA384Managed.Maj(num11, num1, num2);
                int   index4 = index3 + 1;
                ulong num15  = num6 + SHA384Managed.Sigma_1(num13) + SHA384Managed.Ch(num13, num10, num5) + SHA384Managed._K[index4] + expandedBuffer[index4];
                ulong num16  = num2 + num15;
                ulong num17  = num15 + SHA384Managed.Sigma_0(num14) + SHA384Managed.Maj(num14, num11, num1);
                int   index5 = index4 + 1;
                ulong num18  = num5 + SHA384Managed.Sigma_1(num16) + SHA384Managed.Ch(num16, num13, num10) + SHA384Managed._K[index5] + expandedBuffer[index5];
                ulong num19  = num1 + num18;
                ulong num20  = num18 + SHA384Managed.Sigma_0(num17) + SHA384Managed.Maj(num17, num14, num11);
                int   index6 = index5 + 1;
                ulong num21  = num10 + SHA384Managed.Sigma_1(num19) + SHA384Managed.Ch(num19, num16, num13) + SHA384Managed._K[index6] + expandedBuffer[index6];
                num8 = num11 + num21;
                num4 = num21 + SHA384Managed.Sigma_0(num20) + SHA384Managed.Maj(num20, num17, num14);
                int   index7 = index6 + 1;
                ulong num22  = num13 + SHA384Managed.Sigma_1(num8) + SHA384Managed.Ch(num8, num19, num16) + SHA384Managed._K[index7] + expandedBuffer[index7];
                num7 = num14 + num22;
                num3 = num22 + SHA384Managed.Sigma_0(num4) + SHA384Managed.Maj(num4, num20, num17);
                int   index8 = index7 + 1;
                ulong num23  = num16 + SHA384Managed.Sigma_1(num7) + SHA384Managed.Ch(num7, num8, num19) + SHA384Managed._K[index8] + expandedBuffer[index8];
                num6   = num17 + num23;
                num2   = num23 + SHA384Managed.Sigma_0(num3) + SHA384Managed.Maj(num3, num4, num20);
                index1 = index8 + 1;
                ulong num24 = num19 + SHA384Managed.Sigma_1(num6) + SHA384Managed.Ch(num6, num7, num8) + SHA384Managed._K[index1] + expandedBuffer[index1];
                num5 = num20 + num24;
                num1 = num24 + SHA384Managed.Sigma_0(num2) + SHA384Managed.Maj(num2, num3, num4);
            }
            ulong *numPtr = state;
            long   num25  = (long)*numPtr + (long)num1;

            *      numPtr = (ulong)num25;
            IntPtr num26  = (IntPtr)state + 8;
            long   num27  = *(long *)num26 + (long)num2;

            *(long *)num26 = num27;
            IntPtr num28 = (IntPtr)(state + 2);
            long   num29 = *(long *)num28 + (long)num3;

            *(long *)num28 = num29;
            IntPtr num30 = (IntPtr)(state + 3);
            long   num31 = *(long *)num30 + (long)num4;

            *(long *)num30 = num31;
            IntPtr num32 = (IntPtr)(state + 4);
            long   num33 = *(long *)num32 + (long)num5;

            *(long *)num32 = num33;
            IntPtr num34 = (IntPtr)(state + 5);
            long   num35 = *(long *)num34 + (long)num6;

            *(long *)num34 = num35;
            IntPtr num36 = (IntPtr)(state + 6);
            long   num37 = *(long *)num36 + (long)num7;

            *(long *)num36 = num37;
            IntPtr num38 = (IntPtr)(state + 7);
            long   num39 = *(long *)num38 + (long)num8;

            *(long *)num38 = num39;
        }