Fletcher-32 Checksum Calculator
What is Fletcher-32?
The Fletcher-32 checksum algorithm computes a 32-bit checksum designed for error detection. It uses two 16-bit sums calculated while iterating through the data, offering better error detection than simple addition checksums while remaining computationally efficient compared to more complex algorithms like CRC32.
This implementation uses modulo 65535 (216 - 1) for its calculations, as specified in RFC 1146. Fletcher-32 provides stronger error detection than its 16-bit counterpart while maintaining relatively low computational requirements.
Understanding Checksums
A checksum is like a digital fingerprint of your data. When you create or download a file, its checksum is a unique value calculated from its contents. If even a single bit in the file changes, the checksum will be completely different. This makes checksums perfect for:
- File Verification: Compare checksums to ensure a file hasn't been corrupted during download or transfer
- Data Integrity: Quickly detect if files have been modified or tampered with
How Fletcher-32 Works (Mod 65535)
- Initialize two sums,
sum1
andsum2
, to zero. - For each 16-bit word (2 bytes) in the input data:
- Add the word value to
sum1
, taking the result modulo 65535. - Add the new
sum1
value tosum2
, taking the result modulo 65535.
- Add the word value to
- The final 32-bit checksum is formed by concatenating
sum2
(most significant 16 bits) andsum1
(least significant 16 bits). Result = (sum2
<< 16) |sum1
.