Hashing Elements

M

Mike King

Is there a way to create a hash of an element with all of its descendants?
I want to uniquely identify an element within a XML document not by its
position but by its content (not concatenated string values). Something
like a hashed Infoset of an element in a Base64 format.

The reason why I want to do this is because different users of the document
apply different values to the elements in the document.

Right now, I'm running the XML file through a MD5 algorithm which produces a
hash of the file. Then, I save that hash to a file with the values the user
applys to that document, but this approach doesn't allow for the elements to
change their position within the document.

I know XML Digital Signatures might be what I want, but I don't know where
to begin. I'm currently using MSXML4 and .NET for my XML work. Is where
any hope for me?
 
F

FLEB

Regarding this well-known quote, often attributed to Mike King's famous
"Fri, 30 Jul 2004 13:36:10 -0400" speech:
Is there a way to create a hash of an element with all of its descendants?
I want to uniquely identify an element within a XML document not by its
position but by its content (not concatenated string values). Something
like a hashed Infoset of an element in a Base64 format.

The reason why I want to do this is because different users of the document
apply different values to the elements in the document.

Right now, I'm running the XML file through a MD5 algorithm which produces a
hash of the file. Then, I save that hash to a file with the values the user
applys to that document, but this approach doesn't allow for the elements to
change their position within the document.

I know XML Digital Signatures might be what I want, but I don't know where
to begin. I'm currently using MSXML4 and .NET for my XML work. Is where
any hope for me?

You could just pull out indicative portions of the data, sorted into a
particular order, either via a processing script, or with an XSLT
transform, then MD5 that. If things might change order, just force them
into order with a sort.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,020
Latest member
GenesisGai

Latest Threads

Top