示例#1
0
        /// <summary>
        /// Compares the generated hash value from the text with the hash value from the file.
        /// </summary>
        /// <param name="text">The text for generating the hash.</param>
        /// <param name="reader">The textreader for the hash value.</param>
        /// <returns>
        /// true if the hash from the file is equal to the computed hash.
        /// </returns>
        /// <exception cref="ArgumentNullException"><paramref name="reader"/>is null</exception>
        public bool CompareWithHash(string text, ITextReader reader)
        {
            if (reader == null)
            {
                throw new ArgumentNullException("reader");
            }

            return(this.CompareWithHash(text, reader.GetString()));
        }
示例#2
0
        /// <summary>
        /// Compares the computed hash value with the hash value from the input data.
        /// </summary>
        /// <param name="reader">The textreader for computing the hash.</param>
        /// <param name="hashReader">The textreader for the hash value.</param>
        /// <returns>
        /// true if the hash from the textreader is equal to the computed hash.
        /// </returns>
        /// <exception cref="ArgumentNullException"><paramref name="reader"/>is null</exception>
        /// <exception cref="ArgumentNullException"><paramref name="hashReader"/>is null</exception>
        public bool CompareWithHash(ITextReader reader, ITextReader hashReader)
        {
            if (hashReader == null)
            {
                throw new ArgumentNullException("hashReader");
            }

            string hash = this.GetHashFromReader(reader);

            return(hash.Equals(hashReader.GetString(), StringComparison.InvariantCultureIgnoreCase));
        }
示例#3
0
        /// <summary>
        /// Compares the computed hash value with the hash value from the input data.
        /// </summary>
        /// <param name="reader">The textreader for computing the hash.</param>
        /// <param name="hashReader">The textreader for the hash value.</param>
        /// <returns>
        /// true if the hash from the textreader is equal to the computed hash.
        /// </returns>
        /// <exception cref="ArgumentNullException"><paramref name="reader"/>is null</exception>
        /// <exception cref="ArgumentNullException"><paramref name="hashReader"/>is null</exception>
        public bool CompareWithHash(ITextReader reader, ITextReader hashReader)
        {
            if (hashReader == null)
            {
                throw new ArgumentNullException("hashReader");
            }

            string hash = this.GetHashFromReader(reader);
            return hash.Equals(hashReader.GetString(), StringComparison.InvariantCultureIgnoreCase);
        }
示例#4
0
        /// <summary>
        /// Compares the generated hash value from the text with the hash value from the file.
        /// </summary>
        /// <param name="text">The text for generating the hash.</param>
        /// <param name="reader">The textreader for the hash value.</param>
        /// <returns>
        /// true if the hash from the file is equal to the computed hash.
        /// </returns>
        /// <exception cref="ArgumentNullException"><paramref name="reader"/>is null</exception>
        public bool CompareWithHash(string text, ITextReader reader)
        {
            if (reader == null)
            {
                throw new ArgumentNullException("reader");
            }

            return this.CompareWithHash(text, reader.GetString());
        }