469,327 Members | 1,194 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,327 developers. It's quick & easy.

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 4732

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
1 post views Thread by CARIGAR | last post: by
reply views Thread by suresh191 | last post: by
reply views Thread by harlem98 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.