I am trying to serialize an object in xml and then the hash result, but whenever I create a hash, it is always the same for different objects, and not for confidence in what I am doing wrong or missed. Help will be appreciated.
Here is the code I'm using:
private static byte[] CreateHash<T>(T value) { using (MemoryStream stream = new MemoryStream()) using (SHA512Managed hash = new SHA512Managed()) { XmlSerializer serialize = new XmlSerializer(typeof(T)); serialize.Serialize(stream, value); return hash.ComputeHash(stream); } }
source share