TLSharp.Core.MTProto.Crypto.MD5Digest.ProcessBlock C# (CSharp) Method

ProcessBlock() private method

private ProcessBlock ( ) : void
return void
        internal override void ProcessBlock()
        {
            int a = H1;
            int b = H2;
            int c = H3;
            int d = H4;

            //
            // Round 1 - F cycle, 16 times.
            //
            a = RotateLeft((a + F(b, c, d) + X[0] + unchecked((int)0xd76aa478)), S11) + b;
            d = RotateLeft((d + F(a, b, c) + X[1] + unchecked((int)0xe8c7b756)), S12) + a;
            c = RotateLeft((c + F(d, a, b) + X[2] + unchecked(0x242070db)), S13) + d;
            b = RotateLeft((b + F(c, d, a) + X[3] + unchecked((int)0xc1bdceee)), S14) + c;
            a = RotateLeft((a + F(b, c, d) + X[4] + unchecked((int)0xf57c0faf)), S11) + b;
            d = RotateLeft((d + F(a, b, c) + X[5] + unchecked(0x4787c62a)), S12) + a;
            c = RotateLeft((c + F(d, a, b) + X[6] + unchecked((int)0xa8304613)), S13) + d;
            b = RotateLeft((b + F(c, d, a) + X[7] + unchecked((int)0xfd469501)), S14) + c;
            a = RotateLeft((a + F(b, c, d) + X[8] + unchecked(0x698098d8)), S11) + b;
            d = RotateLeft((d + F(a, b, c) + X[9] + unchecked((int)0x8b44f7af)), S12) + a;
            c = RotateLeft((c + F(d, a, b) + X[10] + unchecked((int)0xffff5bb1)), S13) + d;
            b = RotateLeft((b + F(c, d, a) + X[11] + unchecked((int)0x895cd7be)), S14) + c;
            a = RotateLeft((a + F(b, c, d) + X[12] + unchecked(0x6b901122)), S11) + b;
            d = RotateLeft((d + F(a, b, c) + X[13] + unchecked((int)0xfd987193)), S12) + a;
            c = RotateLeft((c + F(d, a, b) + X[14] + unchecked((int)0xa679438e)), S13) + d;
            b = RotateLeft((b + F(c, d, a) + X[15] + unchecked(0x49b40821)), S14) + c;

            //
            // Round 2 - G cycle, 16 times.
            //
            a = RotateLeft((a + G(b, c, d) + X[1] + unchecked((int)0xf61e2562)), S21) + b;
            d = RotateLeft((d + G(a, b, c) + X[6] + unchecked((int)0xc040b340)), S22) + a;
            c = RotateLeft((c + G(d, a, b) + X[11] + unchecked(0x265e5a51)), S23) + d;
            b = RotateLeft((b + G(c, d, a) + X[0] + unchecked((int)0xe9b6c7aa)), S24) + c;
            a = RotateLeft((a + G(b, c, d) + X[5] + unchecked((int)0xd62f105d)), S21) + b;
            d = RotateLeft((d + G(a, b, c) + X[10] + unchecked(0x02441453)), S22) + a;
            c = RotateLeft((c + G(d, a, b) + X[15] + unchecked((int)0xd8a1e681)), S23) + d;
            b = RotateLeft((b + G(c, d, a) + X[4] + unchecked((int)0xe7d3fbc8)), S24) + c;
            a = RotateLeft((a + G(b, c, d) + X[9] + unchecked(0x21e1cde6)), S21) + b;
            d = RotateLeft((d + G(a, b, c) + X[14] + unchecked((int)0xc33707d6)), S22) + a;
            c = RotateLeft((c + G(d, a, b) + X[3] + unchecked((int)0xf4d50d87)), S23) + d;
            b = RotateLeft((b + G(c, d, a) + X[8] + unchecked(0x455a14ed)), S24) + c;
            a = RotateLeft((a + G(b, c, d) + X[13] + unchecked((int)0xa9e3e905)), S21) + b;
            d = RotateLeft((d + G(a, b, c) + X[2] + unchecked((int)0xfcefa3f8)), S22) + a;
            c = RotateLeft((c + G(d, a, b) + X[7] + unchecked(0x676f02d9)), S23) + d;
            b = RotateLeft((b + G(c, d, a) + X[12] + unchecked((int)0x8d2a4c8a)), S24) + c;

            //
            // Round 3 - H cycle, 16 times.
            //
            a = RotateLeft((a + H(b, c, d) + X[5] + unchecked((int)0xfffa3942)), S31) + b;
            d = RotateLeft((d + H(a, b, c) + X[8] + unchecked((int)0x8771f681)), S32) + a;
            c = RotateLeft((c + H(d, a, b) + X[11] + unchecked(0x6d9d6122)), S33) + d;
            b = RotateLeft((b + H(c, d, a) + X[14] + unchecked((int)0xfde5380c)), S34) + c;
            a = RotateLeft((a + H(b, c, d) + X[1] + unchecked((int)0xa4beea44)), S31) + b;
            d = RotateLeft((d + H(a, b, c) + X[4] + unchecked(0x4bdecfa9)), S32) + a;
            c = RotateLeft((c + H(d, a, b) + X[7] + unchecked((int)0xf6bb4b60)), S33) + d;
            b = RotateLeft((b + H(c, d, a) + X[10] + unchecked((int)0xbebfbc70)), S34) + c;
            a = RotateLeft((a + H(b, c, d) + X[13] + unchecked(0x289b7ec6)), S31) + b;
            d = RotateLeft((d + H(a, b, c) + X[0] + unchecked((int)0xeaa127fa)), S32) + a;
            c = RotateLeft((c + H(d, a, b) + X[3] + unchecked((int)0xd4ef3085)), S33) + d;
            b = RotateLeft((b + H(c, d, a) + X[6] + unchecked(0x04881d05)), S34) + c;
            a = RotateLeft((a + H(b, c, d) + X[9] + unchecked((int)0xd9d4d039)), S31) + b;
            d = RotateLeft((d + H(a, b, c) + X[12] + unchecked((int)0xe6db99e5)), S32) + a;
            c = RotateLeft((c + H(d, a, b) + X[15] + unchecked(0x1fa27cf8)), S33) + d;
            b = RotateLeft((b + H(c, d, a) + X[2] + unchecked((int)0xc4ac5665)), S34) + c;

            //
            // Round 4 - K cycle, 16 times.
            //
            a = RotateLeft((a + K(b, c, d) + X[0] + unchecked((int)0xf4292244)), S41) + b;
            d = RotateLeft((d + K(a, b, c) + X[7] + unchecked(0x432aff97)), S42) + a;
            c = RotateLeft((c + K(d, a, b) + X[14] + unchecked((int)0xab9423a7)), S43) + d;
            b = RotateLeft((b + K(c, d, a) + X[5] + unchecked((int)0xfc93a039)), S44) + c;
            a = RotateLeft((a + K(b, c, d) + X[12] + unchecked(0x655b59c3)), S41) + b;
            d = RotateLeft((d + K(a, b, c) + X[3] + unchecked((int)0x8f0ccc92)), S42) + a;
            c = RotateLeft((c + K(d, a, b) + X[10] + unchecked((int)0xffeff47d)), S43) + d;
            b = RotateLeft((b + K(c, d, a) + X[1] + unchecked((int)0x85845dd1)), S44) + c;
            a = RotateLeft((a + K(b, c, d) + X[8] + unchecked(0x6fa87e4f)), S41) + b;
            d = RotateLeft((d + K(a, b, c) + X[15] + unchecked((int)0xfe2ce6e0)), S42) + a;
            c = RotateLeft((c + K(d, a, b) + X[6] + unchecked((int)0xa3014314)), S43) + d;
            b = RotateLeft((b + K(c, d, a) + X[13] + unchecked(0x4e0811a1)), S44) + c;
            a = RotateLeft((a + K(b, c, d) + X[4] + unchecked((int)0xf7537e82)), S41) + b;
            d = RotateLeft((d + K(a, b, c) + X[11] + unchecked((int)0xbd3af235)), S42) + a;
            c = RotateLeft((c + K(d, a, b) + X[2] + unchecked(0x2ad7d2bb)), S43) + d;
            b = RotateLeft((b + K(c, d, a) + X[9] + unchecked((int)0xeb86d391)), S44) + c;

            H1 += a;
            H2 += b;
            H3 += c;
            H4 += d;

            //
            // reset the offset and clean out the word buffer.
            //
            xOff = 0;
            for (int i = 0; i != X.Length; i++)
            {
                X[i] = 0;
            }
        }