Results 1 to 6 of 6

Thread: Check Sum

  1. #1

    Thread Starter
    Fanatic Member
    Join Date
    Jul 2000
    Location
    Manchester NH
    Posts
    833

    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!]

  2. #2
    Hyperactive Member
    Join Date
    May 2006
    Posts
    365

    Re: Check Sum

    Hello Kurt,

    I remember there being four methods of which there would be similarities in creating the check digit.
    I was told the most common was the Mod 11 method.
    You have chosen to add the numbers which gives you a total.
    You next divide this total by 11 giving you a remainder of 1 to 10. This remainder would then become your check digit.
    Other methods involved multiplication of each byte value against a previously decided value, and adding these up, but still Mod 11 would be used to create the check digit.

    Steve
    Is that what you wanted to know or have I got the wrong end of the stick.

  3. #3
    Fanatic Member namrekka's Avatar
    Join Date
    Feb 2005
    Location
    Netherlands
    Posts
    639

    Re: Check Sum

    The most common method is however CRC. This is the most secure for checking data.

    I don't thrust your examples. The first row gives me B0 and the second A0.

    You add a value, if result is bigger then 255 subtract 256 (byte overflow). Thats modulo 256.

  4. #4

    Thread Starter
    Fanatic Member
    Join Date
    Jul 2000
    Location
    Manchester NH
    Posts
    833

    Re: Check Sum

    this is actually what i am trying to solve

    how is the check sum for ~CK` \ C8 ? when ~CK` \ are not hex values

    ~CK` \C8
    Kurt Simons
    [I know I'm a hack but my clients don't!]

  5. #5

    Thread Starter
    Fanatic Member
    Join Date
    Jul 2000
    Location
    Manchester NH
    Posts
    833

    Re: Check Sum

    according to this calculator my examples are wrong.... frustrating

    http://www.lammertbies.nl/comm/info/...+11&method=hex
    Kurt Simons
    [I know I'm a hack but my clients don't!]

  6. #6
    PowerPoster
    Join Date
    Feb 2006
    Location
    East of NYC, USA
    Posts
    5,691

    Re: Check Sum

    Your examples aren't adding the bytes modulo 256. Maybe they're using a different checksum, maybe they're just random bytes as a non-working example.
    The most difficult part of developing a program is understanding the problem.
    The second most difficult part is deciding how you're going to solve the problem.
    Actually writing the program (translating your solution into some computer language) is the easiest part.

    Please indent your code and use [HIGHLIGHT="VB"] [/HIGHLIGHT] tags around it to make it easier to read.

    Please Help Us To Save Ana

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width