SHA-1.4.1: Implementations of the SHA suite of message digest functionsSource codeContentsIndex
Digest and related functions
Calculating hashes
Calculating message authentication codes (MACs)
Pure implementations of the SHA suite of hash functions. The implementation is basically an unoptimized translation of FIPS 180-2 into Haskell. If you're looking for performance, you probably won't find it here.
data Digest
showDigest :: Digest -> String
integerDigest :: Digest -> Integer
bytestringDigest :: Digest -> ByteString
sha1 :: ByteString -> Digest
sha224 :: ByteString -> Digest
sha256 :: ByteString -> Digest
sha384 :: ByteString -> Digest
sha512 :: ByteString -> Digest
hmacSha1 :: ByteString -> ByteString -> Digest
hmacSha224 :: ByteString -> ByteString -> Digest
hmacSha256 :: ByteString -> ByteString -> Digest
hmacSha384 :: ByteString -> ByteString -> Digest
hmacSha512 :: ByteString -> ByteString -> Digest
Digest and related functions
data Digest Source
An abstract datatype for digests.
show/hide Instances
showDigest :: Digest -> StringSource
Convert a digest to a string. The digest is rendered as fixed with hexadecimal number.
integerDigest :: Digest -> IntegerSource
Convert a digest to an Integer.
bytestringDigest :: Digest -> ByteStringSource
Convert a digest to a ByteString.
Calculating hashes
sha1 :: ByteString -> DigestSource
Compute the SHA-1 hash of the given ByteString. The output is guaranteed to be exactly 160 bits, or 20 bytes, long. This is a good default for programs that need a good, but not necessarily hyper-secure, hash function.
sha224 :: ByteString -> DigestSource
Compute the SHA-224 hash of the given ByteString. Note that SHA-224 and SHA-384 differ only slightly from SHA-256 and SHA-512, and use truncated versions of the resulting hashes. So using 224/384 may not, in fact, save you very much ...
sha256 :: ByteString -> DigestSource
Compute the SHA-256 hash of the given ByteString. The output is guaranteed to be exactly 256 bits, or 32 bytes, long. If your security requirements are pretty serious, this is a good choice. For truly significant security concerns, however, you might try one of the bigger options.
sha384 :: ByteString -> DigestSource
Compute the SHA-384 hash of the given ByteString. Yup, you guessed it, the output will be exactly 384 bits, or 48 bytes, long.
sha512 :: ByteString -> DigestSource
For those for whom only the biggest hashes will do, this computes the SHA-512 hash of the given ByteString. The output will be 64 bytes, or 512 bits, long.
Calculating message authentication codes (MACs)
:: ByteStringsecret key
-> ByteStringmessage
-> DigestSHA-1 MAC
Compute an HMAC using SHA-1.
:: ByteStringsecret key
-> ByteStringmessage
-> DigestSHA-224 MAC
Compute an HMAC using SHA-224.
:: ByteStringsecret key
-> ByteStringmessage
-> DigestSHA-256 MAC
Compute an HMAC using SHA-256.
:: ByteStringsecret key
-> ByteStringmessage
-> DigestSHA-384 MAC
Compute an HMAC using SHA-384.
:: ByteStringsecret key
-> ByteStringmessage
-> DigestSHA-512 MAC
Compute an HMAC using SHA-512.
Produced by Haddock version 2.7.2