Trigger Checksum Value

[This is preliminary documentation and subject to change.]

When the broadcast client receives a trigger it needs to verify that the trigger is valid and has not been corrupted during transmission. To permit such validation, each trigger has a checksum value added to the end of the trigger string. The checksum value is represented as four hexadecimal digits surrounded by square brackets. For example:

"1 <CAB> bpc://Mydir/Mycab.cab [4356]"
 

The checksum value is calculated from the trigger string using a standard algorithm. When the client receives the trigger it re-calculates the checksum value from the trigger string and compares that value with the checksum value transmitted with the trigger. If the two values do not match, the client rejects the trigger as invalid.

If you are using the enhancement sender object to transmit triggers to the client, it automatically computes the checksum value and appends it to the trigger string. If you write your own application to transmit triggers to the client, you must implement functionality to calculate the checksum and add it to the trigger string. Otherwise, the client will reject the triggers sent by your application because they will not have a valid checksum value.

The method for computing the checksum value is as follows:

Checksum Algorithm

To compute the checksum, adjacent characters in the string (starting with the first character of the trigger data — not including the trigger key) are paired to form 16-bit integers; if there are an odd number of characters, the final character is paired with a byte of zeros. The checksum is computed so that the one's complement sum of all of these 16-bit integers plus the checksum equals the 16-bit integer with all 1 bits (-0 in one's complement arithmetic); in other words, the checksum is the one's complement of the one's complement sum of the 16-bit integers. This 16-bit checksum is transmitted as four hexadecimal digits in square brackets following the data portion of the trigger. Because the checksum characters themselves (including the surrounding square brackets) are not included in the calculation of the checksum, they must be stripped from the string by the receiver before the checksum is recalculated there.