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.
- data MHV
- class Murmur3Hashable a where
- toCstring :: a -> IO CStringLen
- newtype Str = Str {}
- murmur3 :: Murmur3Hashable a => a -> Int -> MHV -> [Int]
- murmur3' :: Murmur3Hashable a => a -> Int -> MHV -> IO [Int]
- murmur3Int :: Murmur3Hashable a => a -> Int -> Int
- murmur3Int' :: Murmur3Hashable a => a -> Int -> IO Int
- murmur3IntegerX86 :: Murmur3Hashable a => a -> Int -> Integer
- murmur3IntegerX86' :: Murmur3Hashable a => a -> Int -> IO Integer
- murmur3IntegerX64 :: Murmur3Hashable a => a -> Int -> Integer
- murmur3IntegerX64' :: Murmur3Hashable a => a -> Int -> IO Integer
- murmur3Raw :: Murmur3Hashable a => a -> Int -> MHV -> IO [CUInt]
Murmur3 Hash Version
Hashable
class Murmur3Hashable a whereSource
Provides an interface for any value which is capable of being represented as a CString
toCstring :: a -> IO CStringLenSource
Default/Direct Map
Simple, verbose interface for generating hashes
:: Murmur3Hashable a | |
=> a | The hashable to be hashed |
-> Int | A seed value for the hash function |
-> MHV | |
-> [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
:: Murmur3Hashable a | |
=> a | The hashable to be hashed |
-> Int | A seed value for the hash function |
-> Int | 32 bit number generated from the hashable |
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.
:: Murmur3Hashable a | |
=> a | The hashable to be hashed |
-> Int | A seed value for the hash function |
-> IO Int | 32 bit number generated from the hashable |
X86 128 bits
Generate 128 bit hash values, optimized for 32 bit systems
:: Murmur3Hashable a | |
=> a | The hashable to be hashed |
-> Int | A seed value for the hash function |
-> Integer | 128 bit number generated from the hashable |
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!
:: Murmur3Hashable a | |
=> a | The hashable to be hashed |
-> Int | A seed value for the hash function |
-> IO Integer | 128 bit number generated from the hashable |
X64 128 bits
Generate 128 bit hash values, optimized for 64 bit systems
:: Murmur3Hashable a | |
=> a | The hashable to be hashed |
-> Int | A seed value for the hash function |
-> Integer | 128 bit number generated from the hashable |
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.
:: Murmur3Hashable a | |
=> a | The hashable to be hashed |
-> Int | A seed value for the hash function |
-> IO Integer | 128 bit number generated from the hashable |
FFI
murmur3Raw :: Murmur3Hashable a => a -> Int -> MHV -> IO [CUInt]Source
all murmur functions use this and manipulate its response to return a different format