Safe Haskell | None |
---|
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.
- murmur3 :: String -> Int -> MHV -> IO [Int]
- murmur3Int :: String -> Int -> IO Int
- murmur3IntegerX86 :: String -> Int -> IO Integer
- murmur3IntegerX64 :: String -> Int -> IO Integer
- murmur3Raw :: String -> Int -> MHV -> IO [CUInt]
- unsafeMurmur3Int :: String -> Int -> Int
- unsafeMurmur3IntegerX86 :: String -> Int -> Integer
- unsafeMurmur3IntegerX64 :: String -> Int -> Integer
- data MHV
Default/Direct Map
Simple, verbose interface for generating hashes
:: String | The string to be hashed |
-> Int | A seed value for the hash function |
-> MHV | |
-> IO [Int] | returns 4, 32 bit ints, if |
Base function, which allows you to choose which MHV
to use
X86 32 bits
Generate 32 bit hash values
:: 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
:: 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
:: 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
unsafeMurmur3Int :: String -> Int -> IntSource
unsafeMurmur3IntegerX86 :: String -> Int -> IntegerSource
unsafeMurmur3IntegerX64 :: String -> Int -> IntegerSource