/// <summary> /// SHA1 computation /// </summary> /// <param name="data">the data to hash</param> /// <param name="key">not usable</param> /// <returns>the hash value</returns> private static byte[] ComputeAdler32(byte[] data, byte[] key = null) { var digest = new AdlerChecksum(); digest.MakeForBuff(data); var hash = digest.ChecksumValue; return(BitConverter.GetBytes(hash).Reverse().ToArray()); }
/// <summary> /// Equals determines whether two files (buffers) /// have the same checksum value (identical). /// </summary> /// <param name="obj">A AdlerChecksum object for comparison</param> /// <returns>Returns true if the value of checksum is the same /// as this instance; otherwise, false /// </returns> public override bool Equals(object obj) { if (obj == null) { return(false); } if (this.GetType() != obj.GetType()) { return(false); } AdlerChecksum other = (AdlerChecksum)obj; return(this.ChecksumValue == other.ChecksumValue); }