472,102 Members | 1,088 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,102 software developers and data experts.

Help needed calculating/embedding CRC in XML file

Perhaps this is easy, but I'm new to C# am in need of some help.

I need to embed a CRC value into an XML file to be able to detect when the
data contained
therin is corrupted. Calculating the CRC on the DataSet (or an XML
structure) has been the big problem.
This seems like a fairly common problem but I have been unable to find the
solution.

In the world of plain old C, all I needed was the start and end address of
the data in memory
and I could calculate the CRC and store it with the data. This concept
doesn't really exist in
C#. I have a DataSet with the data, but no way to treat it as a byte array
which is what the
one CRC routine I have requires.

In C#, so far I have been using the WriteXML method which wonderfully dumps
a DataSet
to an XML file but doesn't allow me to add anything. I could have a 2nd
table in the dataset
which contains the CRC field and run the calculation on the other table.....

My requirements are only to detect hacking at the file, so a CRC, Hash, MD5,
etc. would all
be workable options. (Although requiring security keys would not be
desired)

Thank you,
Steven
Nov 15 '05 #1
1 5064

I think you might find the article at the following address interesting
http://www.codeproject.com/dotnet/xm...asp?print=true

It's about xml digital signatures, a way to protect your xml data.

Steven.
"StormyTheCat" <st**********@comcast.net> wrote in message
news:RHVyb.389574$Tr4.1145536@attbi_s03...
Perhaps this is easy, but I'm new to C# am in need of some help.

I need to embed a CRC value into an XML file to be able to detect when the
data contained
therin is corrupted. Calculating the CRC on the DataSet (or an XML
structure) has been the big problem.
This seems like a fairly common problem but I have been unable to find the
solution.

In the world of plain old C, all I needed was the start and end address of
the data in memory
and I could calculate the CRC and store it with the data. This concept
doesn't really exist in
C#. I have a DataSet with the data, but no way to treat it as a byte array which is what the
one CRC routine I have requires.

In C#, so far I have been using the WriteXML method which wonderfully dumps a DataSet
to an XML file but doesn't allow me to add anything. I could have a 2nd
table in the dataset
which contains the CRC field and run the calculation on the other table.....
My requirements are only to detect hacking at the file, so a CRC, Hash, MD5, etc. would all
be workable options. (Although requiring security keys would not be
desired)

Thank you,
Steven

Nov 15 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

1 post views Thread by Ing Giuseppe Monteleone | last post: by
1 post views Thread by Tommy Nordgren | last post: by
2 posts views Thread by Jayjay | last post: by
1 post views Thread by Jack | last post: by
reply views Thread by MikeY | last post: by
13 posts views Thread by sandeep chandra | last post: by
1 post views Thread by gavinpaterson | last post: by
reply views Thread by leo001 | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.