H() private static method

private static H ( uint u, uint v, uint w ) : uint
u uint
v uint
w uint
return uint
Exemplo n.º 1
0
        internal override void ProcessBlock()
        {
            for (int i = 16; i < 80; i++)
            {
                uint num = this.X[i - 3] ^ this.X[i - 8] ^ this.X[i - 14] ^ this.X[i - 16];
                this.X[i] = (num << 1 | num >> 31);
            }
            uint num2 = this.H1;
            uint num3 = this.H2;
            uint num4 = this.H3;
            uint num5 = this.H4;
            uint num6 = this.H5;
            int  num7 = 0;

            for (int j = 0; j < 4; j++)
            {
                num6 += (num2 << 5 | num2 >> 27) + Sha1Digest.F(num3, num4, num5) + this.X[num7++] + 1518500249u;
                num3  = (num3 << 30 | num3 >> 2);
                num5 += (num6 << 5 | num6 >> 27) + Sha1Digest.F(num2, num3, num4) + this.X[num7++] + 1518500249u;
                num2  = (num2 << 30 | num2 >> 2);
                num4 += (num5 << 5 | num5 >> 27) + Sha1Digest.F(num6, num2, num3) + this.X[num7++] + 1518500249u;
                num6  = (num6 << 30 | num6 >> 2);
                num3 += (num4 << 5 | num4 >> 27) + Sha1Digest.F(num5, num6, num2) + this.X[num7++] + 1518500249u;
                num5  = (num5 << 30 | num5 >> 2);
                num2 += (num3 << 5 | num3 >> 27) + Sha1Digest.F(num4, num5, num6) + this.X[num7++] + 1518500249u;
                num4  = (num4 << 30 | num4 >> 2);
            }
            for (int k = 0; k < 4; k++)
            {
                num6 += (num2 << 5 | num2 >> 27) + Sha1Digest.H(num3, num4, num5) + this.X[num7++] + 1859775393u;
                num3  = (num3 << 30 | num3 >> 2);
                num5 += (num6 << 5 | num6 >> 27) + Sha1Digest.H(num2, num3, num4) + this.X[num7++] + 1859775393u;
                num2  = (num2 << 30 | num2 >> 2);
                num4 += (num5 << 5 | num5 >> 27) + Sha1Digest.H(num6, num2, num3) + this.X[num7++] + 1859775393u;
                num6  = (num6 << 30 | num6 >> 2);
                num3 += (num4 << 5 | num4 >> 27) + Sha1Digest.H(num5, num6, num2) + this.X[num7++] + 1859775393u;
                num5  = (num5 << 30 | num5 >> 2);
                num2 += (num3 << 5 | num3 >> 27) + Sha1Digest.H(num4, num5, num6) + this.X[num7++] + 1859775393u;
                num4  = (num4 << 30 | num4 >> 2);
            }
            for (int l = 0; l < 4; l++)
            {
                num6 += (num2 << 5 | num2 >> 27) + Sha1Digest.G(num3, num4, num5) + this.X[num7++] + 2400959708u;
                num3  = (num3 << 30 | num3 >> 2);
                num5 += (num6 << 5 | num6 >> 27) + Sha1Digest.G(num2, num3, num4) + this.X[num7++] + 2400959708u;
                num2  = (num2 << 30 | num2 >> 2);
                num4 += (num5 << 5 | num5 >> 27) + Sha1Digest.G(num6, num2, num3) + this.X[num7++] + 2400959708u;
                num6  = (num6 << 30 | num6 >> 2);
                num3 += (num4 << 5 | num4 >> 27) + Sha1Digest.G(num5, num6, num2) + this.X[num7++] + 2400959708u;
                num5  = (num5 << 30 | num5 >> 2);
                num2 += (num3 << 5 | num3 >> 27) + Sha1Digest.G(num4, num5, num6) + this.X[num7++] + 2400959708u;
                num4  = (num4 << 30 | num4 >> 2);
            }
            for (int m = 0; m < 4; m++)
            {
                num6 += (num2 << 5 | num2 >> 27) + Sha1Digest.H(num3, num4, num5) + this.X[num7++] + 3395469782u;
                num3  = (num3 << 30 | num3 >> 2);
                num5 += (num6 << 5 | num6 >> 27) + Sha1Digest.H(num2, num3, num4) + this.X[num7++] + 3395469782u;
                num2  = (num2 << 30 | num2 >> 2);
                num4 += (num5 << 5 | num5 >> 27) + Sha1Digest.H(num6, num2, num3) + this.X[num7++] + 3395469782u;
                num6  = (num6 << 30 | num6 >> 2);
                num3 += (num4 << 5 | num4 >> 27) + Sha1Digest.H(num5, num6, num2) + this.X[num7++] + 3395469782u;
                num5  = (num5 << 30 | num5 >> 2);
                num2 += (num3 << 5 | num3 >> 27) + Sha1Digest.H(num4, num5, num6) + this.X[num7++] + 3395469782u;
                num4  = (num4 << 30 | num4 >> 2);
            }
            this.H1  += num2;
            this.H2  += num3;
            this.H3  += num4;
            this.H4  += num5;
            this.H5  += num6;
            this.xOff = 0;
            Array.Clear(this.X, 0, 16);
        }