473,395 Members | 1,623 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

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

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 12632
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

12
by: Mercuro | last post by:
Hello i'm looking for a simple way to checksum my data. The data is 70 bytes long per record, so a 32 byte hex md5sum would increase the size of my mysql db a lot. I'm looking for something...
2
by: pradeep | last post by:
I have 2 data files, DATA1 and DATA2 , both same. My task is to: Open DATA1, compute the checksum and put it in the end of the file(don't bother about boundary conditions).close DATA1 Open...
4
by: Abby | last post by:
I have an array which contain Hex no. in each position. For examples, unsigned char data; data = 0x00; data = 0x01; data = 0x02; data = 0xE; data = 0xEF; --> This is the checksum value
2
by: Abby | last post by:
I need to do 8 bits 2's complement checksum, so I wrote code in order to see if the checksum calculation is correct. ===========================================================================...
6
by: Kevin | last post by:
I'm on Sun 0S 5.8 and need to calculate the checksum of certain sections in an ELF binary file. Specifically .text to .rodata. I'm able to parse through to the program header table and then find...
6
by: Astroman | last post by:
Hi guys and girls. This is my first time posting here so go easy :) . I was wondering if someone could please interpret how this csum() function works in the following C code. I know that the...
3
by: Andrus | last post by:
Device connected to serial port accepts data packets in the form 02 0x57 ll ll 00 00 00 00 dd..dd cc cc 02 (1 byte ) is message prefix 0x57 (1 byte) is message type (W=Write) ll ll ( 2 bytes)...
1
by: Terry | last post by:
I'm trying to calculate the checksum for UDP packet. The algorithm itself is not difficult (lots of examples out there), but what I'm having the most trouble with is determining the byte order...
1
by: gameMaker | last post by:
I need to be able to build my code into a dll where the checksum of the dll is the same everytime I build it. In other words, the same exact code gives me a different checksum each time I build...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...

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.