bloomfilter-redis-0.1.0.4: Distributed bloom filters on Redis (using the Hedis client).

Safe HaskellTrustworthy
LanguageHaskell2010

Data.RedisBloom.Hash.FNV

Contents

Description

The Fowler–Noll–Vo or FNV hash function, a simple and fast hash function suitable for use in a bloom filter.

See http://www.isthe.com/chongo/tech/comp/fnv for further information.

Synopsis
  • fnv1 :: (Binary a, FiniteBits b, Num b) => a -> b
  • fnv1a :: (Binary a, FiniteBits b, Num b) => a -> b
  • fnv0 :: (Binary a, Num b, FiniteBits b) => a -> b
  • fnvPrime :: forall a. (Num a, FiniteBits a) => a
  • fnvOffsetBasis :: (FiniteBits a, Num a) => a

Hash functions

fnv1 :: (Binary a, FiniteBits b, Num b) => a -> b Source #

Variant 1 of the FNV hash function. The hash is first multiplied with the fnvPrime and then xored with the octet.

http://www.isthe.com/chongo/tech/comp/fnv/#FNV-1

fnv1a :: (Binary a, FiniteBits b, Num b) => a -> b Source #

Variant 1a of the FNV hash function. The hash is first xored with the octet and then multiplied with the fnvPrime.

http://www.isthe.com/chongo/tech/comp/fnv/#FNV-1a

Historical

fnv0 :: (Binary a, Num b, FiniteBits b) => a -> b Source #

Variant 0 is historical and should not be used directly. Rather, it is used to calculate the offset basis (fnvOffsetBasis) of the algorithm (fnv1 and fnv1a).

http://www.isthe.com/chongo/tech/comp/fnv/#FNV-0

Auxiliary constants

fnvPrime :: forall a. (Num a, FiniteBits a) => a Source #

The FNV prime. The prime is calculated automatically based on the number of bits in the resulting type. However, primes for 2^n where n is not in the range 5..9 are not (officialy) supported.

http://www.isthe.com/chongo/tech/comp/fnv/#FNV-param

fnvOffsetBasis :: (FiniteBits a, Num a) => a Source #

The offset basis for the FNV hash function (fnv1 and fnv1a).

http://www.isthe.com/chongo/tech/comp/fnv/#FNV-param