The Winternitz signature uses a checksum that’s very similar to the approach used in Merkle’s scheme.
Recall that the threat is an attacker who increments any byte(s) of the message. The checksum must ensure that the attacker cannot increment any byte of the message proper without voiding the checksum, and that they cannot maul the checksum in a way that would help them.
The solution in this case is to compute a checksum that consists of the sum of the differences between the 255 (the maximum value of a message byte) and each actual message byte being signed. The resulting sum is encoded as a base-256 integer and added to the message. Both the message and checksum are signed.
For an -byte message, the exact checksum formula is:
Where is the byte of the message . As an obvious example, the message (255, 255, 255, 255) would have a checksum of 0. The message (0, 0, 0, 0) would have an integer checksum of 1020, which would encode (base-256) as the bytes (3, 252).