CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 5 of 5
  1. #1
    Join Date
    May 2003
    Location
    Washington, DC
    Posts
    85

    How do I caclulate/use a CheckSum?

    I have an app I wrote in VC++ 6.0 that outputs a binary file. Since this will be transmitted over a TCP and UDP network it has been requested that I add checksum to the file. How do I do that? I've read things here about checksums but they're all not a basic" How do I do it" type questions. Any help or info is most appreciated.

  2. #2
    Join Date
    Mar 2002
    Location
    Croatia
    Posts
    275
    Very simple, you make a sum of all bytes of your data.
    You don't care about overflow.
    After all your data bytes, you send one more byte - a checksum byte.

    The application that receives data makes the same operation. It uses the same algorithm to make a sum of all data bytes.
    Then it check it against the received checksum.
    If equal, no transmittion error occurs.
    If not equal, request for the new transmission.

    It is theoreticaly possible that two errors compensate in the cehcksum but this scenario has a very low possibility. So, this principle is not 100% sure, but it significant reduces transmittion errors.

  3. #3
    Join Date
    May 2003
    Location
    Washington, DC
    Posts
    85
    I heard of something called MD5 but I haven't figured out how to implement it yet.

  4. #4
    Join Date
    Jul 2002
    Posts
    372
    check :

    http://www.boost.org

    about CRC ...

  5. #5
    Join Date
    May 2003
    Location
    Washington, DC
    Posts
    85
    Originally posted by neo_the_1
    check :

    http://www.boost.org

    about CRC ...
    Thanks Neo.... I ended up going with CRC rather than the MD5. Thanks for the help!

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

Featured