Dish-0.0.0.3: Hash modules (currently Murmur3)

Safe HaskellNone

Data.Dish.Murmur3

Contents

Description

This is a Haskell wrapper around the C port of MurmurHash3. https://github.com/zcourts/murmur3 MurmurHash3 is available at https://code.google.com/p/smhasher/wiki/MurmurHash3 The hash functions are designed to work efficiently on x86 processors; in particular, they make some assumptions about the endianness of the processor, and about the speed of unaligned reads.

Synopsis

Default/Direct Map

Simple, verbose interface for generating hashes

murmur3Source

Arguments

:: String

The string to be hashed

-> Int

A seed value for the hash function

-> MHV

Which Murmur Hash version to use X86_32, X86_128 or X64_128

-> IO [Int]

returns 4, 32 bit ints, if X86_32 is used only the first has a value and the other 3 are 0

Base function, which allows you to choose which MHV to use

X86 32 bits

Generate 32 bit hash values

murmur3IntSource

Arguments

:: String

The string to be hashed

-> Int

A seed value for the hash function

-> IO Int

32 bit number generated from the string

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.

X86 128 bits

Generate 128 bit hash values, optimized for 32 bit systems

murmur3IntegerX86Source

Arguments

:: String

The string to be hashed

-> Int

A seed value for the hash function

-> IO Integer

128 bit number generated from the string

Generate a 128 bit hash from the given value, this function's implementation is optimized for 32 bit architectures but works on any. Has about 30% higher throughput than murmur3Int. Be warned, though, that its latency for a single 16-byte key is about 86% longer!

X64 128 bits

Generate 128 bit hash values, optimized for 64 bit systems

murmur3IntegerX64Source

Arguments

:: String

The string to be hashed

-> Int

A seed value for the hash function

-> IO Integer

128 bit number generated from the string

Generate a 128 bit hash from the given value, this function's implementation is optimized for x64 architectures but works on any. Its throughput is 250% higher than murmur3IntegerX86, but it has roughly the same latency.

FFI

murmur3Raw :: String -> Int -> MHV -> IO [CUInt]Source

all murmur functions use this and manipulate its response to return a different format

Unsafe

Murmur3 Hash Version

data MHV Source

Constructors

X86_32 
X86_128 
X64_128