#checksum #crc #hash


Checksums in pure Rust, with no_std available, implementing the Hasher trait

3 unstable releases

Uses old Rust 2015

0.2.1 Nov 23, 2017
0.2.0 Jul 24, 2017
0.1.0 Jul 20, 2017

#517 in Algorithms

Download history 65/week @ 2022-03-06 45/week @ 2022-03-13 27/week @ 2022-03-20 19/week @ 2022-03-27 77/week @ 2022-04-03 57/week @ 2022-04-10 182/week @ 2022-04-17 249/week @ 2022-04-24 220/week @ 2022-05-01 281/week @ 2022-05-08 198/week @ 2022-05-15 185/week @ 2022-05-22 127/week @ 2022-05-29 337/week @ 2022-06-05 231/week @ 2022-06-12 312/week @ 2022-06-19

1,011 downloads per month

MIT license

877 lines


Checksums in pure Rust.

TravisCI Source Crate Documentation CargoMake Changelog SayThanks



Add this crate to the Cargo.toml:

pruefung = "^0.1.0"

Check out the Sums section to see the minimal required version you need depending on the algorithm you wish to use.

All the checksums are implemented using the same logic as the hashes crate of the RustCrypto project, implementing the digest::Digest, and the core::hasher::Hasher traits when possible (less than 64 bits in the output).

Then, to compute a hash, for instance a CRC32 (Ethernet standard):

extern crate pruefung;
use std::hash::Hasher;

let mut hasher = pruefung::crc32::CRC32();   // Instantiate a hasher
let data = b"Hello, world !";

hasher.write(data);                          // Feed the hasher
hasher.write("String data".as_bytes());      // (possibly multiple times)

let hash = hasher.finish();                  // Consume the hasher
println!("Result: {:x}", hash)               // print the result as native hex


The crate itself is no_std, but provides digest::Digest implementations for convenience and integration with the hashes crate. Those bindings can be scrapped off however by disabling the default features of the crates, adding the following line to yout Cargo.toml:

version = "^0.1.0"
default-features = false


Latest version of the crate implements the following checksums:

Algorithm since implemented as
Adler32 0.1.0 ::adler32::Adler32
BSD checksum 0.2.0 ::bsd::Bsd
CRC32 0.2.0 ::crc::crc32::CRC32
CRC32C 0.2.0 ::crc::crc32::CRC32C
Fletcher16 0.1.0 ::fletcher16::Fletcher16
FNV0-32 0.2.0 ::fnv::fnv32::Fnv32z
FNV1-32 0.2.0 ::fnv::fnv32::Fnv32
FNV1a-32 0.2.0 ::fnv::fnv32::Fnv32a
FNV0-64 0.2.0 ::fnv::fnv64::Fnv64z
FNV1-64 0.2.0 ::fnv::fnv64::Fnv64
FNV1a-64 0.2.0 ::fnv::fnv64::Fnv64a
SysV checksum 0.1.0 ::sysv::SysV
UNIX checksum 0.2.0 ::unix::Unix

These checksums are NOT cryptographically secure. They should not be used for something else than data validation against accidental modifications: an attacker could easily forge a file to pass any of these checksums ! For secure checksums, look at the hashes implemented by the RustCrypto team.

Why pruefung ?

I was in Switzerland when I started this project. Yet, I don't really speak german. But a slug version of zyklische-redundanzprüfung seemed like a nice name, instead of another checksum, cksum, checksums, crc, etc. crate.