Iaik.Utils.Hash.HashProvider.Hash C# (CSharp) Method

Hash() public method

Performs the hashing operation. The data is applied to the hash algorithm as they come in dataProviders.
public Hash ( ) : byte[]
return byte[]
        public byte[] Hash(params HashDataProvider[] dataProviders)
        {
            _hashAlgorithm.Initialize ();

            byte[] internalBuffer = new byte[1024 * 4];

            foreach (HashDataProvider dataProvider in dataProviders) {
                int bufferLength;
                do {
                    bufferLength = dataProvider.NextBytes (internalBuffer);

                    if (bufferLength > 0)
                        _hashAlgorithm.TransformBlock (internalBuffer, 0, bufferLength, internalBuffer, 0);
                } while (bufferLength > 0);
            }

            _hashAlgorithm.TransformFinalBlock (internalBuffer, 0, 0);
            return _hashAlgorithm.Hash;
        }

Same methods

HashProvider::Hash ( byte buffer, int index ) : void

Usage Example

Exemplo n.º 1
0
        public bool CompareTo(params HashDataProvider[] hashDataProviders)
        {
            HashProvider hasher = new HashProvider (_hashAlgo);

            byte[] localHash = hasher.Hash (hashDataProviders);

            return ByteHelper.CompareByteArrays (_digest, localHash);
        }
All Usage Examples Of Iaik.Utils.Hash.HashProvider::Hash