示例#1
0
        public override IHashResult TransformFinal()
        {
            int idx;

            var hash = new byte[ParallelismDegree][];

            for (idx = 0; idx < hash.Length; idx++)
            {
                hash[idx] = new byte[OutSizeInBytes];
            }

            for (idx = 0; idx < ParallelismDegree; idx++)
            {
                if (_bufferLength > (ulong)(idx * BlockSizeInBytes))
                {
                    var left = _bufferLength - (ulong)(idx * BlockSizeInBytes);
                    left = Math.Min(left, BlockSizeInBytes);
                    _leafHashes[idx].TransformBytes(_buffer, idx * BlockSizeInBytes, (int)left);
                }

                hash[idx] = _leafHashes[idx].TransformFinal().GetBytes();
            }

            for (idx = 0; idx < ParallelismDegree; idx++)
            {
                _rootHash.TransformBytes(hash[idx], 0, OutSizeInBytes);
            }

            var result = _rootHash.TransformFinal();

            Initialize();

            return(result);
        }