Esempio n. 1
0
        protected override void HashCore(byte[] array, int ibStart, int cbSize)
        {
            int startIndex       = ibStart;
            int totalArrayLength = _dataSize + cbSize;

            if (totalArrayLength >= 64)
            {
                Array.Copy(array, startIndex, _data, _dataSize, 64 - _dataSize);
                // Process message of 64 bytes (512 bits)
                Md5Core.GetHashBlock(_data, ref _abcd, 0);
                startIndex       += 64 - _dataSize;
                totalArrayLength -= 64;
                while (totalArrayLength >= 64)
                {
                    Array.Copy(array, startIndex, _data, 0, 64);
                    Md5Core.GetHashBlock(array, ref _abcd, startIndex);
                    totalArrayLength -= 64;
                    startIndex       += 64;
                }
                _dataSize = totalArrayLength;
                Array.Copy(array, startIndex, _data, 0, totalArrayLength);
            }
            else
            {
                Array.Copy(array, startIndex, _data, _dataSize, cbSize);
                _dataSize = totalArrayLength;
            }
            _totalLength += cbSize;
        }
Esempio n. 2
0
 protected override byte[] HashFinal()
 {
     //field cannot access
     //HashValue = Md5Core.GetHashFinalBlock(_data, 0, _dataSize, _abcd, _totalLength * 8);
     //return HashValue;
     return(Md5Core.GetHashFinalBlock(_data, 0, _dataSize, _abcd, _totalLength * 8));
 }
Esempio n. 3
0
 protected override byte[] HashFinal()
 {
     HashValue = Md5Core.GetHashFinalBlock(_data, 0, _dataSize, _abcd, _totalLength * 8);
     return(HashValue);
 }