a05b763b01
SHA3 is still waiting for final standardization. Although this is looking less likely given https://www.cdt.org/blogs/joseph-lorenzo-hall/2409-nist-sha-3 In the meantime, cryptohash implements skein, and it's used by some of the haskell ecosystem (for yesod sessions, IIRC), so this implementation is likely to continue working. Also, I've talked with the cryprohash author and he's a reasonable guy. It makes sense to have an alternate high security hash, in case some horrible attack is found against SHA2 tomorrow, or in case SHA3 comes out and worst fears are realized. I'd also like to support using skein for HMAC. But no hurry there and a new version of cryptohash has much nicer HMAC code, so I will probably wait until I can use that version.
33 lines
732 B
Haskell
33 lines
732 B
Haskell
{- Convenience wrapper around cryptohash.
|
|
-
|
|
- The resulting Digests can be shown to get a canonical hash encoding. -}
|
|
|
|
module Utility.Hash where
|
|
|
|
import Crypto.Hash
|
|
import qualified Data.ByteString.Lazy as L
|
|
|
|
sha1 :: L.ByteString -> Digest SHA1
|
|
sha1 = hashlazy
|
|
|
|
sha224 :: L.ByteString -> Digest SHA224
|
|
sha224 = hashlazy
|
|
|
|
sha256 :: L.ByteString -> Digest SHA256
|
|
sha256 = hashlazy
|
|
|
|
sha384 :: L.ByteString -> Digest SHA384
|
|
sha384 = hashlazy
|
|
|
|
sha512 :: L.ByteString -> Digest SHA512
|
|
sha512 = hashlazy
|
|
|
|
-- sha3 is not yet fully standardized
|
|
--sha3 :: L.ByteString -> Digest SHA3
|
|
--sha3 = hashlazy
|
|
|
|
skein256 :: L.ByteString -> Digest Skein256_256
|
|
skein256 = hashlazy
|
|
|
|
skein512 :: L.ByteString -> Digest Skein512_512
|
|
skein512 = hashlazy
|