libchibi

Crates.iolibchibi
lib.rslibchibi
version
sourcesrc
created_at2024-11-23 23:06:58.932211
updated_at2024-11-23 23:06:58.932211
descriptionSafe FFI wrapper for Chibihash64 by N-R-K. Chibihash64 is a small, fast, and portable 64 bit non-cryptographic hash function.
homepage
repositoryhttps://github.com/crypdoughdoteth/libchibi/
max_upload_size
id1458803
Cargo.toml error:TOML parse error at line 18, column 1 | 18 | autolib = false | ^^^^^^^ unknown field `autolib`, expected one of `name`, `version`, `edition`, `authors`, `description`, `readme`, `license`, `repository`, `homepage`, `documentation`, `build`, `resolver`, `links`, `default-run`, `default_dash_run`, `rust-version`, `rust_dash_version`, `rust_version`, `license-file`, `license_dash_file`, `license_file`, `licenseFile`, `license_capital_file`, `forced-target`, `forced_dash_target`, `autobins`, `autotests`, `autoexamples`, `autobenches`, `publish`, `metadata`, `keywords`, `categories`, `exclude`, `include`
size0
crypdough.eth (crypdoughdoteth)

documentation

README

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.

Commit count: 11

cargo fmt