#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

#2102 in Algorithms

Download history 339/week @ 2024-02-26 275/week @ 2024-03-04 64/week @ 2024-03-11 153/week @ 2024-03-18 137/week @ 2024-03-25 144/week @ 2024-04-01 160/week @ 2024-04-08 141/week @ 2024-04-15 188/week @ 2024-04-22 307/week @ 2024-04-29 154/week @ 2024-05-06 122/week @ 2024-05-13 138/week @ 2024-05-20 217/week @ 2024-05-27 173/week @ 2024-06-03 221/week @ 2024-06-10

754 downloads per month
Used in 3 crates (via cardano-message-signing)

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.