Package 'fletcher'

Title: Compute Fletcher Checksums (16, 32, and 64 Bit)
Description: Computes Fletcher's position-dependent checksum in 16-, 32-, and 64-bit widths. Fletcher's checksum, devised by John G. Fletcher, provides error-detection properties approaching a cyclic redundancy check at lower computational cost. Input is processed as little-endian words with the final partial word zero-padded, so results are reproducible across platforms.
Authors: Christos Longros [aut, cre]
Maintainer: Christos Longros <[email protected]>
License: MIT + file LICENSE
Version: 0.1.0
Built: 2026-07-15 20:45:56 UTC
Source: https://github.com/cran/fletcher

Help Index


Compute a Fletcher checksum

Description

Computes Fletcher's position-dependent checksum. Input is processed as little-endian words with the final partial word zero-padded, so the result is reproducible across platforms.

Usage

fletcher(x, width = 32L)

Arguments

x

A character string, a raw vector, or an integer/numeric vector of byte values (0-255) coercible with as.raw. Character input is converted with charToRaw.

width

Checksum width in bits; one of 16, 32, or 64.

Value

A lowercase hexadecimal string of width / 4 characters.

Examples

fletcher("abcde", 16)  # "c8f0"
fletcher("abcde", 32)  # "f04fc729"
fletcher("abcde", 64)  # "c8c6c527646362c6"