|
-
May 22nd, 2006, 10:23 AM
#1
Thread Starter
Fanatic Member
Check Sum
I need some help understanding check sums and how to work with them in VB.
how do i validate the following line is "correct"... B4 is the check some value for the line
74 11 12 00 2E 22 74 13 12 00 2E 22 B4
Check Sum
Check Sum is a method where we use modulo summation to detect errors in a stream of data. Usually the sum operation is operated on package of bytes where the last byte is the Check Sum number. When you add all the numbers in the package the sum should be zero (in octets the addition is modulo 256, it means that if the sum reaches to 256 it turns to zero), if from some reason it isn't then we know that there is an error.
Check Sum has no ability to correct errors but only detect them.
Let's see an example:
12 40 05 80 FB 12 00 26 B4 BB 09 B4 12 28 74 11 BB
12 00 2E 22 12 00 26 75 00 00 FA 12 00 26 25 00 3A
F5 00 DA F7 12 00 26 B5 00 06 74 10 12 00 2E 22 F1
74 11 12 00 2E 22 74 13 12 00 2E 22 B4 In the example we can see a block of octets that are represented in Hexadecimal. The last number in every row is a number that if you sum the whole row, and there is no error, you should get a zero.
It's important to mention that you should build a reasonable row, that is, not very short where the overhead would be too much, and not very long because if you detect that there is an error you should send the whole message again.
Last edited by kurtsimons; May 22nd, 2006 at 12:46 PM.
Kurt Simons
[I know I'm a hack but my clients don't!]
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|