Skip to content

badboy/murmurhash64-rs

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

36 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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.