Data.Digest.Murmur64

murmur-hash-0.1.0.8: MurmurHash2 implementation for Haskell.

Copyright | (c) Thomas Schilling 2010
License | BSD-style
Maintainer | nominolo@gmail.com
Stability | experimental
Portability | portable
Safe Haskell | Safe
Language | Haskell98

Data.Digest.Murmur64

Description

Type class and primitives for constructing 64 bit hashes using the MurmurHash2 algorithm. See http://murmurhash.googlepages.com for details on MurmurHash2.

Synopsis

- data Hash64
- asWord64 :: Hash64 -> Word64
- class Hashable64 a where
  - hash64Add :: a -> Hash64 -> Hash64
- hash64AddWord64 :: Word64 -> Hash64 -> Hash64
- hash64AddInt :: Int -> Hash64 -> Hash64
- hash64 :: Hashable64 a => a -> Hash64
- hash64WithSeed :: Hashable64 a => Word64 -> a -> Hash64
- combine :: (Hash64 -> Hash64) -> (Hash64 -> Hash64) -> Hash64 -> Hash64

# Documentation

data Hash64

A 64 bit hash.

Instances

Bounded Hash64 |
Eq Hash64 |
Ord Hash64 |
Show Hash64 |

asWord64 :: Hash64 -> Word64

Extract 64 bit word from hash.

class Hashable64 a where

Methods

hash64Add :: a -> Hash64 -> Hash64

Instances

Hashable64 Bool |
Hashable64 Char |
Hashable64 Int |
Hashable64 Integer |
Hashable64 Word64 |
Hashable64 () |
Hashable64 ByteString |
Hashable64 ByteString |
Hashable64 a => Hashable64 [a] |
Hashable64 a => Hashable64 (Maybe a) |
(Hashable64 a, Hashable64 b) => Hashable64 (Either a b) |
(Hashable64 a, Hashable64 b) => Hashable64 (a, b) |
(Hashable64 a, Hashable64 b, Hashable64 c) => Hashable64 (a, b, c) |
(Hashable64 a, Hashable64 b, Hashable64 c, Hashable64 d) => Hashable64 (a, b, c, d) |

hash64AddWord64 :: Word64 -> Hash64 -> Hash64

Add a 64 bit word to the hash.

hash64AddInt :: Int -> Hash64 -> Hash64

hash64 :: Hashable64 a => a -> Hash64

Create a hash using the default seed.

hash64WithSeed :: Hashable64 a => Word64 -> a -> Hash64

Create a hash using a custom seed. h The seed should be non-zero, but other than that can be an arbitrary number. Different seeds will give different hashes, and thus (most likely) different hash collisions.

combine :: (Hash64 -> Hash64) -> (Hash64 -> Hash64) -> Hash64 -> Hash64

Combine two hash generators. E.g.,

      hashFoo (Foo a) = hash64AddInt 1 combine hash64Add a