Exemple #1
0
        /// <summary>
        /// Computes the hash value from the content of a file.
        /// </summary>
        /// <param name="reader">The reader for the input data.</param>
        /// <returns>Hash as a hex-string.</returns>
        /// <exception cref="ArgumentNullException"><paramref name="reader"/>is null</exception>
        public string GetHashFromReader(ITextReader reader)
        {
            if (reader == null)
            {
                throw new ArgumentNullException("reader");
            }

            using (Stream stream = reader.GetStream())
            {
                return this.algorithm.ComputeHashFromStream(stream);
            }
        }
Exemple #2
0
        /// <summary>
        /// Computes the hash value from the content of a file.
        /// </summary>
        /// <param name="reader">The reader for the input data.</param>
        /// <returns>Hash as a hex-string.</returns>
        /// <exception cref="ArgumentNullException"><paramref name="reader"/>is null</exception>
        public string GetHashFromReader(ITextReader reader)
        {
            if (reader == null)
            {
                throw new ArgumentNullException("reader");
            }

            using (Stream stream = reader.GetStream())
            {
                return(this.algorithm.ComputeHashFromStream(stream));
            }
        }