@@ -58,8 +58,8 @@ class ValidAlgo (a :: HashAlgorithm) where
5858 -- | Finish hashing and generate the output.
5959 finalize :: AlgoCtx a -> Digest a
6060
61- -- | An algorithm with a canonical name, for serialization purposes
62- -- (e.g. SRI hashes)
61+ -- | A 'HashAlgorithm' with a canonical name, for serialization
62+ -- purposes (e.g. SRI hashes)
6363class NamedAlgo (a :: HashAlgorithm ) where
6464 algoName :: Text
6565
@@ -91,26 +91,29 @@ hashLazy :: forall a.ValidAlgo a => BSL.ByteString -> Digest a
9191hashLazy bsl =
9292 finalize $ foldl' (update @ a ) (initialize @ a ) (BSL. toChunks bsl)
9393
94- -- | Encode a Digest in the special Nix base-32 encoding.
94+ -- | Encode a ' Digest' in the special Nix base-32 encoding.
9595encodeBase32 :: Digest a -> T. Text
9696encodeBase32 (Digest bs) = Base32. encode bs
9797
98- -- | Encode a Digest in hex.
98+ -- | Encode a ' Digest' in hex.
9999encodeBase16 :: Digest a -> T. Text
100100encodeBase16 (Digest bs) = T. decodeUtf8 (Base16. encode bs)
101101
102+ -- | Uses "Crypto.Hash.MD5" from cryptohash-md5.
102103instance ValidAlgo 'MD5 where
103104 type AlgoCtx 'MD5 = MD5. Ctx
104105 initialize = MD5. init
105106 update = MD5. update
106107 finalize = Digest . MD5. finalize
107108
109+ -- | Uses "Crypto.Hash.SHA1" from cryptohash-sha1.
108110instance ValidAlgo 'SHA1 where
109111 type AlgoCtx 'SHA1 = SHA1. Ctx
110112 initialize = SHA1. init
111113 update = SHA1. update
112114 finalize = Digest . SHA1. finalize
113115
116+ -- | Uses "Crypto.Hash.SHA256" from cryptohash-sha256.
114117instance ValidAlgo 'SHA256 where
115118 type AlgoCtx 'SHA256 = SHA256. Ctx
116119 initialize = SHA256. init
0 commit comments