
21 Mar
2013
21 Mar
'13
10:36 a.m.
On 21 March 2013 06:54, wren ng thornton
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