Fletcher32

Fletcher32 checksum algorithm.

uint32_t fletcher32(const uint16_t * buf, msp430_types.h::size_t words)

Fletcher’s 32 bit checksum.

found on http://en.wikipedia.org/w/index.php?title=Fletcher%27s_checksum&oldid=661273016#Optimizations

Note

the returned sum is never 0

Note

pay attention to alignment issues since this operates on an input buffer containing 16 bit words, not bytes.

Parameters

buf:input buffer to hash
words:length of buffer, in 16 bit words

Return values

  • 32 bit sized hash in the interval [1..2^32]