Skip to content

fletcher_16

fletcher_16(data): number

Defined in: checksum/fletcher_16.ts:16

Computes the Fletcher-16 checksum of data (John Fletcher, 1982).

Two running sums mod 255 of individual bytes — weaker error detection than a CRC of the same degree, but cheaper: no polynomial division, only addition and a compare-and-subtract-equivalent modulus.

Complexity: O(n) in the byte length of data.

Uint8Array

The bytes to check.

number

An unsigned 16-bit checksum, the high byte holding the sum of sums and the low byte holding the sum of bytes.