How to create a SHA1 digest on a tree of objects?
- by Torok Balint
Let's say that I have a tree of objects of which every one have a string representation. I want to create a SHA1 digest on the whole tree.
The easiest way would be to recursively go over each node of the tree. For each node I would concatenate (as simple strings) the SHA1 digests of all the children, add the string representation of the given nod to this concatenated string, and do a SHA1 on it. This would be the SHA1 digest of the given node.
The question is will this digest be just as "good" as if I would have concatenated the string representation of the child nodes, and not the digests of the child nodes?
Thanks