#hash

murmurhash64

Implementation of MurmurHash2 (64bit version)

5 unstable releases

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

#146 in Cryptography

Download history 184/week @ 2018-10-11 305/week @ 2018-10-18 98/week @ 2018-10-25 286/week @ 2018-11-01 294/week @ 2018-11-08 392/week @ 2018-11-15 360/week @ 2018-11-22 466/week @ 2018-11-29 210/week @ 2018-12-06 314/week @ 2018-12-13 49/week @ 2018-12-20 49/week @ 2018-12-27 291/week @ 2019-01-03 285/week @ 2019-01-10 320/week @ 2019-01-17

116 downloads per month
Used in 2 crates

BSD-3-Clause

9KB
153 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

~1MB
~11K SLoC