/// <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())); }
/// <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)); }
/// <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); }
/// <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()); }