Note, that the conversion to unsigned short * will produce a pointer that combine
two bytes each position. Therefore, +3 at the end has the following effect:
Basically, the algorithm adds the uint16 values starting from position 0 until a index variable is reaching 0. Even if the values are copied from a packed which was sent by the SADP Tool there is a checksum mismatch.
This issue has been fixed since patch version 1.1.0. The main algorithm implementation was correct, only the input parameters were interpreted wrong. See checksum.h for details on the
arguments.
Checksum Algorithm
Although, the checksum algorithm is discovered and decompiled here, the implemented method in python always returns a wrong result.
Description of the algorithm
The call which is done in BuildSADPPacket() is the following:
Note, that the conversion to unsigned short * will produce a pointer that combine two bytes each position. Therefore, +3 at the end has the following effect:
The next step is to convert the returned unsigned short value into a single byte value:
The input buffer is the following:
Basically, the algorithm adds the uint16 values starting from position 0 until a index variable is reaching 0. Even if the values are copied from a packed which was sent by the SADP Tool there is a checksum mismatch.