Proposal: Add the unordered-containers package and the hashable package to the Haskell Platform
Bas van Dijk
v.dijk.bas at gmail.com
Thu Mar 21 14:36:34 GMT 2013
On 21 March 2013 06:54, wren ng thornton <wren at freegeek.org> wrote:
> One concern with the above approach: is "siphash" a sufficiently generic
> name, or is it just one hashing method that happens to deflect this DoS
> issue? I haven't read the paper, so...
One could of course generalize the above method using something like:
-- A type hashed as h
newtype Hashed h a = Hashed a
instance (HashableAs h a) => Hashable (Hashed h a) where
hashWithSalt = hashWithSaltAs
class HashableAs h a where
hashWithSaltAs :: Int -> Hashed h a -> Int
data Sip
sip :: a -> Hashed Sip a
sip = Hashed
instance HashableAs Sip Text where
hashWithSaltAs salt (Hashed x) = sipHashWithSalt salt x
instance HashableAs Sip ByteString where
...
Regards,
Bas
More information about the Haskell-platform
mailing list