"Unique hash" is generally a contradiction in terms, even in general terms (and it s more obviously impossible if you re trying to use an Int32
as the hash value). From the wikipedia entry:
A hash function is any well-defined
procedure or mathematical function
that converts a large, possibly
variable-sized amount of data into a
small datum, usually a single integer
that may serve as an index to an
array. The values returned by a hash
function are called hash values, hash
codes, hash sums, or simply hashes.
Note the "small datum" bit - in other words, there will be more possible objects than there are possible hash values, so you can t possibly have uniqueness.
Now, it sounds like you actually want the hash to be a string... which means it won t be of a fixed size (but will have to be under 2GB or whatever the limit is). The simplest way of producing this "unique hash" would be to serialize the object and convert the result into a string, e.g. using Base64 if it s a binary serialization format, or just the text if it s a text-based one such as JSON. However, that s not what anyone else would really recognise as "hashing".