What is this?
This is a Nim module that takes files as arguments and outputs their respective Fletcher checksum. The Fletcher checksum has a bit lower error detection reliability than for example the well known CRC-32 but it is generally a lot faster than for example CRC-32 as well as Adler-32. The project's goal is to provide a very fast checksum algorithm to be used on devices like the Raspberry Pi.
The project in general is considered Work In Progress. The most reliable variation is Fletcher16, as it is not dependent on the CPU architecture's endianness and the way the algorithm was implemented, is approved to work. The Fletcher32's only weakness is its dependence on the CPU's endianness, which might affect the comparison of checksums between different CPU architectures on different machines, otherwise it is just as stable as Fletcher16.
Currently implemented variations
The visual test, where you can check the values yourself, is optional:
nim doc --project fletcher.nim
Creates documentation for the entire project.
Choose your way of using the API.
from fletcher import fletcher let fileChecksum_1: uint64 = fletcher("myfile.bin", "16") fileChecksum_2 = "myfile.bin".fletcher("32b") fileChecksum_3: uint64 = fletcher(filename = "myfile.bin", bits = "sixtyfour") fileChecksum_4 = "myfile.bin".fletcher # the default is the 16-bit variation
Compare a variable amount of files to a source file by checksum.
from fletcher import fletcherCompare let fileComparison_1: bool = fletcherCompare(bits = "16", original = "path/to/source_file", filenames = "path/to/destfile1", "path/to/destfile2", "path/to/destfile3") fileComparison_2 = "16".fletcherCompare("path/to/source_file", "path/to/destfile1", "path/to/destfile2", "path/to/destfile3")
For testing purposes and development
nim.cfg with optimizations as compilation arguments.
Deletes the generated
- make Fletcher32+ independent of CPU architecture
- add optional Base64 encoding
- apply delay type optimization
- apply modulo substitution optimization
- checksum text
varargs file comparison import statement optimizations add documentation