File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Generating a Checksum Value

 
Brendan Crisler
Greenhorn
Posts: 19
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'm trying to create a 100 byte ASCII string to send over a com port. Byte 99 in the string needs to be an 8-bit checksum. How do I set this byte? I've seen the java.util.zip package, but I'm not sure if that's just used for 'reading' a checksum or not. Any help is appreciated.
 
Henry Wong
author
Marshal
Pie
Posts: 20836
75
C++ Chrome Eclipse IDE Firefox Browser Java jQuery Linux VI Editor Windows
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
These days the term checksum doesn't have a meaning, in terms of an actual definition. In the past, it just means the sum of the values of all the bytes in the packet, ignoring overflows. These days, it just means a way to check -- and doesn't really imply that you are taking a sum.

It could be just a sum. It could be a CRC, of which there are tons of formulas. It could be a message digest -- MD5, SHA1, etc. It could be nearly anything. Now, admittedly, many that I listed are not 8-bit, so it may not be those.

Regardless, you need to look up, the actually definition of checksum -- used in your application, as it will be nearly impossible to guess what this thing you are communicating with, is expecting.

Henry
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic