Giter Club home page Giter Club logo

murmur3go's Introduction

Go port of Murmur3 hash

This is a port of the Murmur3 hash function. Murmur3 is a non-cryptographic hash, designed to be fast and excellent-quality for making things like hash tables or bloom filters.

This is a port of the C implementation by Peter Scott. We only use x86/128 so this is the only implementation we have.

How to use it

All code lives in murmur package. Signatures and code in general are kept as similar to C implementation as possible.

func MurmurHash3_x86_128 (key []byte, seed uint32) ([2]uint64)

The interface is: You give a key, a byte slice of the data you wish to hash; seed, an arbitrary seed number which you can use to tweak the hash. You get an array of two uint64 (Go <= 1.9 does not yet have a uint128).

The hash functions differ in both their internal mechanisms and in their outputs. They are specialized for different use cases:

MurmurHash3_x86_32 has the lowest throughput, but also the lowest latency. If you're making a hash table that usually has small keys, this is probably the one you want to use on 32-bit machines. It has a 32-bit output. (not yet ported)

MurmurHash3_x86_128 is also designed for 32-bit systems, but produces a 128-bit output, and has about 30% higher throughput than the previous hash. Be warned, though, that its latency for a single 16-byte key is about 86% longer! (ported - for LittleEndian only)

MurmurHash3_x64_128 is the best of the lot, if you're using a 64-bit machine. Its throughput is 250% higher than MurmurHash3_x86_32, but it has roughly the same latency. It has a 128-bit output. (not yet ported)

License and contributing

All this code is in the public domain. Murmur3 was created by Austin Appleby, and the C port and general tidying up was done by Peter Scott. The Go port was done by Andreas Bergmeier and licensed under Apache License 2.0.

murmur3go's People

Contributors

abergmeier-dsfishlabs avatar

Stargazers

 avatar

Watchers

 avatar  avatar

Forkers

pombredanne

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.