469,609 Members | 1,169 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

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

Checksum

hi,

need help here, does anyone know how to use or does any one have the code
for checksum? I want to checksum a string to be sent using udp and checksum
it again when received.. does anyone know the code for checksum? Thanks i
would really really appreciate it. Thanks in advance..
Oct 23 '06 #1
4 12322
KH
I'm assuming you mean the CHECKSUM function in SQL server; if not disregard.

Anyways ... no, no one has the code for CHICKSUM. Well the SQL Server team
must, but you shouldn't rely on it anyways - a hash function like CHECKSUM or
..NET's GetHashCode() can change from version to version so you shouldn't rely
on it.

What you should do is use a well known hash algorithym like MD5 or SHA1, and
use that for your comparisons. See the System.Security.Cryptography namespace
in .NET SDK.
"Rain" wrote:
hi,

need help here, does anyone know how to use or does any one have the code
for checksum? I want to checksum a string to be sent using udp and checksum
it again when received.. does anyone know the code for checksum? Thanks i
would really really appreciate it. Thanks in advance..
Oct 23 '06 #2

The easiest way is use Hash functions like MD5, SHA1.
Check out them in System.Security.Cryptography namespace.
Note that MD5 generates a byte array of 128 bytes (SHA1, 160 bytes).
You can convert them to hex string if needed.

Rain wrote:
hi,

need help here, does anyone know how to use or does any one have the code
for checksum? I want to checksum a string to be sent using udp and checksum
it again when received.. does anyone know the code for checksum? Thanks i
would really really appreciate it. Thanks in advance..
Oct 23 '06 #3

I mean bits, not bytes. And someone else already answered above, did
not notice.

Truong Hong Thi wrote:
The easiest way is use Hash functions like MD5, SHA1.
Check out them in System.Security.Cryptography namespace.
Note that MD5 generates a byte array of 128 bytes (SHA1, 160 bytes).
You can convert them to hex string if needed.

Rain wrote:
hi,

need help here, does anyone know how to use or does any one have the code
for checksum? I want to checksum a string to be sent using udp and checksum
it again when received.. does anyone know the code for checksum? Thanks i
would really really appreciate it. Thanks in advance..
Oct 23 '06 #4
Rain wrote:
hi,

need help here, does anyone know how to use or does any one have the code
for checksum? I want to checksum a string to be sent using udp and
checksum it again when received.. does anyone know the code for checksum?
Thanks i would really really appreciate it. Thanks in advance..
Hi,

There are a number of checksum functions available, each with their merits
(and their disadvantages). Hashing (as has been mentioned) is a popular
method of creating a checksum, but there are also algorithms such as CRC -
the Cyclic Redundancy Check.

For your reference, here is an URL to an implementation of CRC:
http://www.codeproject.com/csharp/marcelcrcencoding.asp

--
Hope this helps,
Tom Spink

Google first, ask later.
Oct 23 '06 #5

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

12 posts views Thread by Mercuro | last post: by
2 posts views Thread by pradeep | last post: by
2 posts views Thread by Abby | last post: by
6 posts views Thread by Kevin | last post: by
6 posts views Thread by Astroman | last post: by
3 posts views Thread by Andrus | last post: by
1 post views Thread by Terry | last post: by
reply views Thread by devrayhaan | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.