Another popular hashing algorithm is SHA (Secure Hash Algorithm) that produces a 160 bit digest ensuring greater security than MD5. It doesn’t matter how long the digest is, an identical digest will always result for an identical packet. But anyone wishing to attack the system could monitor exchanges and determine which packets sent in what ever order would result in some known result. This result could therefore be reproduced by replay of the messages. This is known as a collision attack.
HMAC (Hash-based Message Authentication Code) can be used to combat collision attacks by including two calculated values know as ipid and opid, which are initially calculated using the secret key for the first packet and recalculated for subsequent packets. The values are stored after each packet and recovered for use in the calculation of the digest for the next packet. This ensures that the digest is always different even for identical packets.