#hash

murmurhash64

Implementation of MurmurHash2 (64bit version)

5 unstable releases

Uses old Rust 2015

0.3.1 Mar 3, 2016
0.3.0 Jan 27, 2016
0.2.0 May 9, 2015
0.1.1 Nov 22, 2014
0.1.0 Nov 20, 2014

#152 in #hash

Download history 16/week @ 2021-05-22 13/week @ 2021-05-29 37/week @ 2021-06-05 13/week @ 2021-06-12 37/week @ 2021-06-19 17/week @ 2021-06-26 18/week @ 2021-07-03 24/week @ 2021-07-10 43/week @ 2021-07-17 22/week @ 2021-07-24 23/week @ 2021-07-31 26/week @ 2021-08-07 47/week @ 2021-08-14 49/week @ 2021-08-21 34/week @ 2021-08-28 18/week @ 2021-09-04

169 downloads per month
Used in 5 crates (3 directly)

BSD-3-Clause

9KB
152 lines

MurmurHash2 (64bit) implementation

Build Status crates.io

Based on the implementation for Redis (antirez/redis src/hyperloglog.c)

More info and different implementations available at: https://sites.google.com/site/murmurhash/

Documentation

Build

cargo build --release

Usage

use murmurhash64::murmur_hash64a;

fn main() {
    let key = "Pizza & Mandolino";
    let seed = 2915580697;

    let hash = murmur_hash64a(key.as_bytes(), seed);
}

As a Hasher

use std::collections::HashMap;
use murmurhash64::{MurmurHasher,RandomMurmurState};
use std::default::Default;

fn main() {
    let mut hashmap : HashMap<_, _, RandomMurmurState> = Default::default();
    hashmap.insert("abc", 123);
    hashmap.insert("def", 456);
    assert_eq!(Some(&123), hashmap.get("abc"));
    assert_eq!(Some(&456), hashmap.get("def"));
}

Tests

Run tests with:

cargo test

Contribute

If you find bugs or want to help otherwise, please open an issue.

License

BSD. See LICENSE.

Dependencies

~360KB