CRC Files

  • Thread starter Thread starter Wayne
  • Start date Start date
W

Wayne

I want to take a checksum of a file, and store it. I use the checksum list
to compare to the current file I'm checking, if it's checksum is in the list
I delete the file.

Is there anything built in to .net that will give me back a checksum of a
file?
if so will it be unique enough to trust for the above?

if nothing built in, anything someone can suggest that is freely avail on
the web?

Thanks
Wayne Sepega
Jacksonville, Fl
 
Hi Wayne,
I want to take a checksum of a file, and store it. I use the checksum list
to compare to the current file I'm checking, if it's checksum is in the list
I delete the file.

Is there anything built in to .net that will give me back a checksum of a
file?

MD5CryptoServiceProvider
SHA1CryptoServiceProvider

both in the System.Security.Cryptography namespace
if so will it be unique enough to trust for the above?

Yes ;-)

bye
Rob
 
Wayne said:
I want to take a checksum of a file, and store it. I use the checksum list
to compare to the current file I'm checking, if it's checksum is in the list
I delete the file.

Is there anything built in to .net that will give me back a checksum of a
file?
if so will it be unique enough to trust for the above?

if nothing built in, anything someone can suggest that is freely avail on
the web?

Robert mentioned SHA1 and MD5. These are both likely to be slower than
a "simple" checksum, but more secure. If you're trying to avoid
tampering, a cryptographic hash like SHA1 or MD5 is a good idea. If
you're only trying to avoid accidental corruptiong, a checksum should
be fine.

I have a simple implementation of Adler32 in my "MiscUtil" library
available at
http://www.pobox.com/~skeet/csharp/miscutil

Feel free to use it in your own project.
 
This should do what I need.

--
Thanks
Wayne Sepega
Jacksonville, Fl

"When a man sits with a pretty girl for an hour, it seems like a minute. But
let him sit on a hot stove for a minute and it's longer than any hour.
That's relativity." - Albert Einstein
 
Back
Top