c# Serilize object to xml and hash the result
I've been trying to serialize an object to xml and then hash the result but whenever I create the hash its always the same for different objects, not to sure what I'm doing wrong or have left out. Help would 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);
            }            
        }

c# Serilize object to xml and hash the result
===

I've been trying to serialize an object to xml and then hash the result but whenever I create the hash its always the same for different objects, not to sure what I'm doing wrong or have left out. Help would 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);
            }            
        }
