libchibi 0.1.0

Safe FFI wrapper for Chibihash64 by N-R-K. Chibihash64 is a small, fast, and portable 64 bit non-cryptographic hash function.
Documentation
  • Coverage
  • 30%
    3 out of 10 items documented1 out of 9 items with examples
  • Size
  • Source code size: 8.6 kB This is the summed size of all the files inside the crates.io package for this release.
  • Documentation size: 133.5 kB This is the summed size of all files generated by rustdoc for all configured targets
  • Ø build duration
  • this release: 7s Average build duration of successful builds.
  • all releases: 7s Average build duration of successful builds in releases after 2024-10-23.
  • Links
  • crypdoughdoteth/libchibi
    1 1 0
  • crates.io
  • Dependencies
  • Versions
  • Owners
  • crypdoughdoteth

Libchibi

For simplicity and ease of use, this library statically links the original implementation of Chibihash64. The current goal of this library is to provide safe bindings to the implementation and integrate with the Rust standard library's Hasher trait.

Usage

use std::hash::Hasher;
use libchibi::Chibihash;

let mut chibi = Chibihash::new(42);
chibi.write(b"Vyper");
chibi.write(b"GM");
let hash = chibi.finish();
println!("{hash:?}");

 // Basic interface
let chibi = Chibihash::new(42);
let hash = chibi.hash(b"GM");
println!("{hash:?}");

When Not To Use

As stated in the README of the original repository,

The introduction should make it clear on why you'd want to use this. Here are some reasons to avoid using this:

  • For cryptographic purposes.

  • For protecting against collision attacks (SipHash is the recommended one for this purpose).

  • When you need very strong probability against collisions: ChibiHash does very minimal amount of mixing compared to other hashes (e.g xxhash64). And so chances of collision should in theory be higher.""

Origin of Chibihash64

The implementation for the hash function was written by N-R-K and can be found here

Bugs

Please open an issue if you encounter any bugs as this crate makes use of unsafe Rust by its nature.