aboutsummaryrefslogtreecommitdiff
path: root/src/Data
diff options
context:
space:
mode:
Diffstat (limited to 'src/Data')
-rw-r--r--src/Data/Digest.hs21
-rw-r--r--src/Data/Digest/Internal.hs3
-rw-r--r--src/Data/Hmac.hs6
3 files changed, 8 insertions, 22 deletions
diff --git a/src/Data/Digest.hs b/src/Data/Digest.hs
index e0e0540..3bd042c 100644
--- a/src/Data/Digest.hs
+++ b/src/Data/Digest.hs
@@ -18,10 +18,7 @@ module Data.Digest
, hash
, md5
, sha1
- , sha224
- , sha256
- , sha384
- , sha512
+ , sha224, sha256, sha384, sha512
) where
import qualified Data.ByteString as ByteString
@@ -37,22 +34,12 @@ import Internal.Digest
type LazyByteString = ByteString.Lazy.ByteString
-md5 :: Algorithm
-md5 = Algorithm evpMd5
-
-sha1 :: Algorithm
-sha1 = Algorithm evpSha1
-
-sha224 :: Algorithm
+md5, sha1, sha224, sha256, sha384, sha512 :: Algorithm
+md5 = Algorithm evpMd5
+sha1 = Algorithm evpSha1
sha224 = Algorithm evpSha224
-
-sha256 :: Algorithm
sha256 = Algorithm evpSha256
-
-sha384 :: Algorithm
sha384 = Algorithm evpSha384
-
-sha512 :: Algorithm
sha512 = Algorithm evpSha512
-- | Hashes according to the given 'Algorithm'.
diff --git a/src/Data/Digest/Internal.hs b/src/Data/Digest/Internal.hs
index f8db383..be88e68 100644
--- a/src/Data/Digest/Internal.hs
+++ b/src/Data/Digest/Internal.hs
@@ -27,8 +27,7 @@ import Internal.Base (EvpMd)
newtype Algorithm = Algorithm (Ptr EvpMd)
-- | The result of a hash operation.
-newtype Digest =
- Digest ByteString
+newtype Digest = Digest ByteString
deriving (Eq, Ord)
instance Show Digest where
diff --git a/src/Data/Hmac.hs b/src/Data/Hmac.hs
index d1124b6..2211248 100644
--- a/src/Data/Hmac.hs
+++ b/src/Data/Hmac.hs
@@ -46,9 +46,9 @@ newtype Hmac = Hmac ByteString
instance Eq Hmac where
(Hmac a) == (Hmac b) =
unsafeLocalState $
- ByteString.unsafeUseAsCStringLen a $ \(a', size) ->
- ByteString.unsafeUseAsCStringLen b $ \(b', _) ->
- constantTimeEquals a' b' size
+ ByteString.unsafeUseAsCStringLen a $ \(a', size) ->
+ ByteString.unsafeUseAsCStringLen b $ \(b', _) ->
+ constantTimeEquals a' b' size
instance Show Hmac where
show (Hmac m) = show (Digest m)