コード例 #1
0
        private unsafe void _HashData(byte[] partIn, int ibStart, int cbSize)
        {
            int byteCount      = cbSize;
            int srcOffsetBytes = ibStart;
            int dstOffsetBytes = (int)(this._count & 63L);

            this._count = this._count + (long)byteCount;
            fixed(uint *state = this._stateMD160)
            fixed(byte *block       = this._buffer)
            fixed(uint *blockDWords = this._blockDWords)
            {
                if (dstOffsetBytes > 0 && dstOffsetBytes + byteCount >= 64)
                {
                    Buffer.InternalBlockCopy((Array)partIn, srcOffsetBytes, (Array)this._buffer, dstOffsetBytes, 64 - dstOffsetBytes);
                    srcOffsetBytes += 64 - dstOffsetBytes;
                    byteCount      -= 64 - dstOffsetBytes;
                    RIPEMD160Managed.MDTransform(blockDWords, state, block);
                    dstOffsetBytes = 0;
                }
                while (byteCount >= 64)
                {
                    Buffer.InternalBlockCopy((Array)partIn, srcOffsetBytes, (Array)this._buffer, 0, 64);
                    srcOffsetBytes += 64;
                    byteCount      -= 64;
                    RIPEMD160Managed.MDTransform(blockDWords, state, block);
                }
                if (byteCount > 0)
                {
                    Buffer.InternalBlockCopy((Array)partIn, srcOffsetBytes, (Array)this._buffer, dstOffsetBytes, byteCount);
                }
            }
        }
コード例 #2
0
        private unsafe void _HashData(byte[] partIn, int ibStart, int cbSize)
        {
            int i    = cbSize;
            int num  = ibStart;
            int num2 = (int)(this._count & 63L);

            this._count += (long)i;
            fixed(uint *stateMD = this._stateMD160)
            {
                fixed(byte *buffer = this._buffer)
                {
                    fixed(uint *blockDWords = this._blockDWords)
                    {
                        if (num2 > 0 && num2 + i >= 64)
                        {
                            Buffer.InternalBlockCopy(partIn, num, this._buffer, num2, 64 - num2);
                            num += 64 - num2;
                            i   -= 64 - num2;
                            RIPEMD160Managed.MDTransform(blockDWords, stateMD, buffer);
                            num2 = 0;
                        }
                        while (i >= 64)
                        {
                            Buffer.InternalBlockCopy(partIn, num, this._buffer, 0, 64);
                            num += 64;
                            i   -= 64;
                            RIPEMD160Managed.MDTransform(blockDWords, stateMD, buffer);
                        }
                        if (i > 0)
                        {
                            Buffer.InternalBlockCopy(partIn, num, this._buffer, num2, i);
                        }
                    }
                }
            }
        }