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 Source #

SigHash Key

Constructors

SipKey !Word64 !Word64 |

newtype SipHash Source #

Siphash tag value

Constructors

SipHash Word64 |

#### Instances

Instances details

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

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

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

`sipHash` is equivalent to 'sipHashWith 2 4'

sipHashWith Source #

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 Source #

FNV1(a) hash (32 bit variants)

Constructors

FnvHash32 Word32 |

#### Instances

Instances details

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

Instance details

Defined in Data.Memory.Hash.FNV

Methods

compare :: FnvHash32 -> FnvHash32 -> Ordering Source #

(<) :: FnvHash32 -> FnvHash32 -> Bool Source #

(<=) :: FnvHash32 -> FnvHash32 -> Bool Source #

(>) :: FnvHash32 -> FnvHash32 -> Bool Source #

(>=) :: FnvHash32 -> FnvHash32 -> Bool Source #

max :: FnvHash32 -> FnvHash32 -> FnvHash32 Source #

min :: FnvHash32 -> FnvHash32 -> FnvHash32 Source #

newtype FnvHash64 Source #

FNV1(a) hash (64 bit variants)

Constructors

FnvHash64 Word64 |

#### Instances

Instances details

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

Instance details

Defined in Data.Memory.Hash.FNV

Methods

compare :: FnvHash64 -> FnvHash64 -> Ordering Source #

(<) :: FnvHash64 -> FnvHash64 -> Bool Source #

(<=) :: FnvHash64 -> FnvHash64 -> Bool Source #

(>) :: FnvHash64 -> FnvHash64 -> Bool Source #

(>=) :: FnvHash64 -> FnvHash64 -> Bool Source #

max :: FnvHash64 -> FnvHash64 -> FnvHash64 Source #

min :: FnvHash64 -> FnvHash64 -> FnvHash64 Source #

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

Compute the FNV1 32 bit hash value of a byte array

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

Compute the FNV1a 32 bit hash value of a byte array

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

Compute the FNV1 64 bit hash value of a byte array

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

Compute the FNV1a 64 bit hash value of a byte array