cwpearson / nim-murmurhash

Pure-nim MurmurHash implementation

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

nim-murmur

Build Status

A pure-nim implementation of MurmurHash. Has MurmurHash3 and MurmurHash2, and does not wrap a C implementation.

Adapted from https://github.com/aappleby/smhasher

Using

This is in the nimble package manager as murmurhash, so you can put

requires murmurhash>=0.4.0

in your nimble file. Or, to pin to a particuar commit, do

requires "https://github.com/cwpearson/nim-murmurhash#b44ed52"

then,

import murmurhash

About

Only two functions implemented currently.

  • Murmur3
    • MurmurHash3_x64_128
    • MurmurHash3_x86_32
    • MurmurHash3_x86_128
  • Murmur2
    • MurmurHash64A - The original 64-bit version. Optimized for 64-bit arithmetic.
    • MurmurHash2 - The original version; contains a flaw that weakens collision in some cases.
    • MurmurHash2A - A fixed variant using Merkle–Damgård construction construction. Slightly slower.
    • CMurmurHash2A - MurmurHash2A but works incrementally.
    • MurmurHashNeutral2 - Slower, but endian and alignment neutral.
    • MurmurHashAligned2 - Slower, but does aligned reads (safer on some platforms).
    • MurmurHash64B (64-bit, x86) - A 64-bit version optimized for 32-bit platforms. Unfortunately it is not a true 64-bit hash due to insufficient mixing of the stripes.
  • Murmur
    • MurmurHash1

Related:

About

Pure-nim MurmurHash implementation


Languages

Language:Nim 97.5%Language:Shell 2.5%