deterministic-hash 1.0.2

Create deterministic hashes regardless of architecture
Documentation
  • Coverage
  • 40%
    2 out of 5 items documented2 out of 5 items with examples
  • Size
  • Source code size: 6.92 kB This is the summed size of all the files inside the crates.io package for this release.
  • Documentation size: 957.78 kB This is the summed size of all files generated by rustdoc for all configured targets
  • Ø build duration
  • this release: 13s Average build duration of successful builds.
  • all releases: 9s Average build duration of successful builds in releases after 2024-10-23.
  • Links
  • Wassasin/deterministic-hash
    3 1 0
  • crates.io
  • Dependencies
  • Versions
  • Owners
  • Wassasin

deterministic-hash

Tiny Rust library to create deterministic hashes regardless of architecture. This library is no-std compatible and uses no allocations or dependencies.

The default core::hash::Hasher implementation ensures a platform dependant hashing of datastructures that use #[derive(Hash)]. Most notably by:

  • using to_ne_bytes for u{8,16,32,64,128}.
  • using the native bytelength of usize.

The DeterministicHasher of this library forces the use of to_le_bytes and casts usize to u64 regardless of your platform. Hence the hasher will be less efficient, but will be deterministic when using the same library in different architecture contexts. I use a common dataprotocol library both on ARM embedded systems, wasm and x64.

You can validate the operation of this library with cross by running:

cargo install cross
cross test --target=x86_64-unknown-linux-gnu
cross test --target=aarch64-unknown-linux-gnu
cross test --target=arm-unknown-linux-gnueabihf