simhash 0.3.0

Simhash algorithm for 64-bit locality-sensitive hashing and similarity calculation
Documentation

Simhash for Rust

CI crates.io

Simhash algorithm (developed by Moses Charikar) implemented in Rust. It generates 64-bit simhashes and can calculate similarities using the Hamming distance.

Usage

Add simhash to your Cargo.toml:

[dependencies]
simhash = "0.3"
fn main() {
    let hash = simhash::simhash("The cat sat on the mat");
    println!("{hash}");

    let similarity = simhash::similarity("The cat sat on the mat", "The cat sat under the mat");
    println!("{similarity}");
}

Features

By default, simhash uses SipHash as its internal hasher. You can switch to FNV instead:

[dependencies]
simhash = { version = "0.3", default-features = false, features = ["hasher-fnv"] }

License

MIT