memory-0.18.0: memory and related abstraction stuff

License | BSD-style
Maintainer | Vincent Hanquez <vincent@snarc.org>
Stability | experimental
Portability | good
Safe Haskell | None
Language | Haskell2010

Data.ByteArray.Hash

Contents

- SipHash
- FNV1 and FNV1a (32 and 64 bits)

Description

provide the SipHash algorithm. reference: http://131002.net/siphash/siphash.pdf

Synopsis

- data SipKey = SipKey !Word64 !Word64
- newtype SipHash = SipHash Word64
- sipHash :: ByteArrayAccess ba => SipKey -> ba -> SipHash
- sipHashWith :: ByteArrayAccess ba => Int -> Int -> SipKey -> ba -> SipHash
- newtype FnvHash32 = FnvHash32 Word32
- newtype FnvHash64 = FnvHash64 Word64
- fnv1Hash :: ByteArrayAccess ba => ba -> FnvHash32
- fnv1aHash :: ByteArrayAccess ba => ba -> FnvHash32
- fnv1_64Hash :: ByteArrayAccess ba => ba -> FnvHash64
- fnv1a_64Hash :: ByteArrayAccess ba => ba -> FnvHash64

# SipHash

data SipKey #

SigHash Key

Constructors

SipKey !Word64 !Word64 |

newtype SipHash #

Siphash tag value

Constructors

SipHash Word64 |

#### Instances

Instances details

Show SipHash # |
Instance details Defined in Data.Memory.Hash.SipHash Methods showsPrec :: Int -> SipHash -> ShowS # show :: SipHash -> String # showList :: [SipHash] -> ShowS #
Eq SipHash # |
Instance details Defined in Data.Memory.Hash.SipHash Methods (==) :: SipHash -> SipHash -> Bool # (/=) :: SipHash -> SipHash -> Bool #
Ord SipHash # |
Instance details Defined in Data.Memory.Hash.SipHash Methods compare :: SipHash -> SipHash -> Ordering # (<) :: SipHash -> SipHash -> Bool # (<=) :: SipHash -> SipHash -> Bool # (>) :: SipHash -> SipHash -> Bool # (>=) :: SipHash -> SipHash -> Bool # max :: SipHash -> SipHash -> SipHash # min :: SipHash -> SipHash -> SipHash #

sipHash :: ByteArrayAccess ba => SipKey -> ba -> SipHash #

Compute the SipHash tag of a byte array for a given key.

`sipHash` is equivalent to 'sipHashWith 2 4'

sipHashWith #

Arguments

:: ByteArrayAccess ba |
=> Int | c rounds
-> Int | d rounds
-> SipKey | key
-> ba | data to hash
-> SipHash |

Compute the SipHash tag of a byte array for a given key.

The user can choose the C and D numbers of rounds.

calling `sipHash` is equivalent to 'sipHashWith 2 4'

# FNV1 and FNV1a (32 and 64 bits)

newtype FnvHash32 #

FNV1(a) hash (32 bit variants)

Constructors

FnvHash32 Word32 |

#### Instances

Instances details

Show FnvHash32 # |
Instance details Defined in Data.Memory.Hash.FNV Methods showsPrec :: Int -> FnvHash32 -> ShowS # show :: FnvHash32 -> String # showList :: [FnvHash32] -> ShowS #
NFData FnvHash32 # |
Instance details Defined in Data.Memory.Hash.FNV Methods rnf :: FnvHash32 -> () #
Eq FnvHash32 # |
Instance details Defined in Data.Memory.Hash.FNV Methods (==) :: FnvHash32 -> FnvHash32 -> Bool # (/=) :: FnvHash32 -> FnvHash32 -> Bool #
Ord FnvHash32 # |
Instance details Defined in Data.Memory.Hash.FNV Methods compare :: FnvHash32 -> FnvHash32 -> Ordering # (<) :: FnvHash32 -> FnvHash32 -> Bool # (<=) :: FnvHash32 -> FnvHash32 -> Bool # (>) :: FnvHash32 -> FnvHash32 -> Bool # (>=) :: FnvHash32 -> FnvHash32 -> Bool # max :: FnvHash32 -> FnvHash32 -> FnvHash32 # min :: FnvHash32 -> FnvHash32 -> FnvHash32 #

newtype FnvHash64 #

FNV1(a) hash (64 bit variants)

Constructors

FnvHash64 Word64 |

#### Instances

Instances details

Show FnvHash64 # |
Instance details Defined in Data.Memory.Hash.FNV Methods showsPrec :: Int -> FnvHash64 -> ShowS # show :: FnvHash64 -> String # showList :: [FnvHash64] -> ShowS #
NFData FnvHash64 # |
Instance details Defined in Data.Memory.Hash.FNV Methods rnf :: FnvHash64 -> () #
Eq FnvHash64 # |
Instance details Defined in Data.Memory.Hash.FNV Methods (==) :: FnvHash64 -> FnvHash64 -> Bool # (/=) :: FnvHash64 -> FnvHash64 -> Bool #
Ord FnvHash64 # |
Instance details Defined in Data.Memory.Hash.FNV Methods compare :: FnvHash64 -> FnvHash64 -> Ordering # (<) :: FnvHash64 -> FnvHash64 -> Bool # (<=) :: FnvHash64 -> FnvHash64 -> Bool # (>) :: FnvHash64 -> FnvHash64 -> Bool # (>=) :: FnvHash64 -> FnvHash64 -> Bool # max :: FnvHash64 -> FnvHash64 -> FnvHash64 # min :: FnvHash64 -> FnvHash64 -> FnvHash64 #

fnv1Hash :: ByteArrayAccess ba => ba -> FnvHash32 #

Compute the FNV1 32 bit hash value of a byte array

fnv1aHash :: ByteArrayAccess ba => ba -> FnvHash32 #

Compute the FNV1a 32 bit hash value of a byte array

fnv1_64Hash :: ByteArrayAccess ba => ba -> FnvHash64 #

Compute the FNV1 64 bit hash value of a byte array

fnv1a_64Hash :: ByteArrayAccess ba => ba -> FnvHash64 #

Compute the FNV1a 64 bit hash value of a byte array