Home

Fletcher32

Fletcher32 is a 32-bit checksum algorithm that belongs to the Fletcher family of checksums. It is designed to detect accidental data corruption in blocks of data and is used as a lightweight method for error detection in various software and hardware contexts. Fletcher32 aims to provide better error detection than simpler checksums while remaining computationally efficient.

The algorithm uses two 16-bit accumulators, s1 and s2, initialized to zero. It processes the input data

Fletcher32 is valued for its speed on typical processors and its ability to detect a wide range

Implementation notes often include handling endianness consistently and ensuring that odd-length data is padded appropriately. Fletcher32

as
a
sequence
of
16-bit
words;
if
the
total
number
of
bytes
is
odd,
the
last
byte
is
padded
with
a
zero
to
form
a
final
16-bit
word.
For
each
word
w,
the
updates
are:
s1
=
(s1
+
w)
mod
65535,
and
s2
=
(s2
+
s1)
mod
65535.
After
processing
all
words,
the
32-bit
checksum
is
formed
by
combining
the
two
accumulators
as
(s2
<<
16)
|
s1.
The
modulus
65535
(0xFFFF)
is
used
to
keep
the
sums
within
16-bit
bounds.
of
error
patterns,
including
several
single-bit
and
burst
errors.
However,
it
is
not
as
robust
as
cyclic
redundancy
checks
(CRCs)
against
all
error
patterns,
and
it
is
not
suitable
for
cryptographic
integrity
or
security
purposes.
is
employed
in
various
data
integrity
contexts
where
a
balance
between
protection
level
and
computational
overhead
is
desired,
serving
as
a
practical
alternative
to
more
complex
error-detection
schemes
in
lightweight
systems.