Esempio n. 1
0
        protected override byte[] HashFinal()
        {
            byte[] buffer = new byte[m_Size];
            int    length = buffer.Length;

            if (SspiProvider.CryptGetHashParam(m_Hash, SecurityConstants.HP_HASHVAL, buffer, ref length, 0) == 0)
            {
                throw new CryptographicException("The hash value could not be read.");
            }
            return(buffer);
        }
        /// <summary>
        /// Returns the computed <see cref="MD4CryptoServiceProvider"/> hash as an array of bytes after all data has been written to the object.
        /// </summary>
        /// <returns>The computed hash value.</returns>
        /// <exception cref="ObjectDisposedException">The MD4CryptoServiceProvider instance has been disposed.</exception>
        /// <exception cref="CryptographicException">The data could not be hashed.</exception>
        protected override byte[] HashFinal()
        {
            if (m_Disposed)
            {
                throw new ObjectDisposedException(this.GetType().FullName);
            }
            byte[] buffer = new byte[16];
            int    length = buffer.Length;

            if (SspiProvider.CryptGetHashParam(m_Hash, SecurityConstants.HP_HASHVAL, buffer, ref length, 0) == 0)
            {
                throw new CryptographicException("The hash value could not be read.");
            }
            return(buffer);
        }