Exemplo n.º 1
0
        // Write data to the underlying hash algorithm.
        protected override void HashCore(byte[] array, int ibStart, int cbSize)
        {
            // Validate the parameters.
            if (array == null)
            {
                throw new ArgumentNullException("array");
            }
            else if (ibStart < 0 || ibStart > array.Length)
            {
                throw new ArgumentOutOfRangeException
                          ("ibStart", _("ArgRange_Array"));
            }
            else if (cbSize < 0 || (array.Length - ibStart) < cbSize)
            {
                throw new ArgumentException(_("Arg_InvalidArrayRange"));
            }

            // Bail out if the runtime engine does not have a provider.
            if (state == IntPtr.Zero)
            {
                throw new CryptographicException
                          (_("Crypto_NoProvider"), "RIPEMD160");
            }

            // Update the RIPEMD160 state.
            lock (this)
            {
                CryptoMethods.HashUpdate(state, array, ibStart, cbSize);
            }
        }