fletcher-pure
fletcher-pure — zero-dependency pure-stdlib Fletcher-16 checksum per RFC 3309 / ISO/IEC 3309.
No dependencies. No C extension. Pure Python stdlib — runs anywhere Python runs.
Quick Start
pip install -e .
from fletcher_pure import checksum, verify
c = checksum(b"Hello") # int in [0, 65535]
ok = verify(b"Hello", 0x1A3F) # bool
Why fletcher-pure?
Embedded systems engineers and serverless Python developers working on legacy protocol parsers (X.25, ISO/IEC 3309) need a pure-Fletcher-16 checksum utility without pulling in a heavy library. The crcmod package weighs several MB and requires C compilation; fletcher on PyPI has unknown runtime deps.
fletcher-pure provides:
- Zero runtime dependencies — pure Python stdlib only
- RFC 3309 / ISO/IEC 3309 compliant Fletcher-16 mod-255
- Arbitrary input size — Python int arithmetic never overflows
- Typing included — full type annotations
Key Features
checksum(data: bytes) -> int— Fletcher-16 mod-255, returns int in [0, 65535]verify(data: bytes, expected: int) -> bool— True iff checksum matches- Zero pip dependencies at runtime
- Works on inputs up to 65535 bytes (and beyond) without overflow
- Full type annotations
- 100% test coverage of acceptance criteria
API Reference
checksum(data: bytes) -> int
Compute the Fletcher-16 checksum (mod 255) of data.
checksum(b"") # 0
checksum(b"\x00") # 0 (c0=c1=0 initialization per RFC 3309 §5.1)
checksum(b"\x01\x02") # 1027
checksum(b"\xff\xff") # 0 (mod-255 wrap)
checksum(b"123456789") # 0x1EDE = 7902
verify(data: bytes, expected: int) -> bool
Return True if checksum(data) == expected, False otherwise.
verify(b"Hello", checksum(b"Hello")) # True
verify(b"Hello", checksum(b"Hello") ^ 0x0001) # False (corruption detected)
verify(b"", 0) # True
Raises TypeError if data is not bytes or bytearray.
CLI
No CLI is provided. Use as a library:
from fletcher_pure import checksum, verify
Limitations
- Fletcher-16 is not cryptographically secure — use SHA-256 for security purposes.
- Collisions are possible for larger inputs (birthday paradox applies).
- No streaming / chunked API — entire input must fit in memory.
verifydoes not acceptmemoryview(onlybytesandbytearray).
Non-Goals
- No CRC32, Adler-32, or other checksum algorithms.
- No CLI tool.
- No native/C extension for speed.
- No support for Python < 3.8.
Install
pip install -e .
For development:
git clone https://github.com/prasad-a-abhishek/fletcher-pure.git
cd fletcher-pure
pip install -e .
pytest
License
MIT License — see LICENSE file.
Metadata
Release files for fletcher-pure 0.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| fletcher_pure-0.1.0.tar.gz | 8.3 kB | Without provenance | Details for fletcher_pure-0.1.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| fletcher_pure-0.1.0-py3-none-any.whl | Python 3 | none | any | Details for fletcher_pure-0.1.0-py3-none-any.whl |
Total release size: 12.2 kB
Release files / fletcher_pure-0.1.0.tar.gz
| Download URL | fletcher_pure-0.1.0.tar.gz |
|---|---|
| Size | 8.3 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
c79fecb0463bab876fe6f4743cba5d0042bef1001e5a9e32ba8fb1a754533c6f
|
|
BLAKE2b-256 checksum How to use checksums |
08c5a78389e72043cc8e8ca84d98d847f81dbd93e4f2c09adf60c13a95e8930e
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.11.15
|
Release files / fletcher_pure-0.1.0-py3-none-any.whl
| Download URL | fletcher_pure-0.1.0-py3-none-any.whl |
|---|---|
| Size | 4.0 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
e666482dcdfd8a2d7423685fe7d848c6c38defdc35e419e99a660ab8d2c5692f
|
|
BLAKE2b-256 checksum How to use checksums |
739c9824ee62baa4427fdd1b3cb53456a20e5bd916a646a3cda4f97920a62462
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.11.15
|
Security for fletcher-pure 0.1.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.