Skip to content

Commit 44b97fb

Browse files
committed
Hash: Haddock tweaks.
1 parent f3f0193 commit 44b97fb

File tree

1 file changed

+7
-4
lines changed
  • hnix-store-core/src/System/Nix/Internal

1 file changed

+7
-4
lines changed

hnix-store-core/src/System/Nix/Internal/Hash.hs

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -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)
6363
class NamedAlgo (a :: HashAlgorithm) where
6464
algoName :: Text
6565

@@ -91,26 +91,29 @@ hashLazy :: forall a.ValidAlgo a => BSL.ByteString -> Digest a
9191
hashLazy 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.
9595
encodeBase32 :: Digest a -> T.Text
9696
encodeBase32 (Digest bs) = Base32.encode bs
9797

98-
-- | Encode a Digest in hex.
98+
-- | Encode a 'Digest' in hex.
9999
encodeBase16 :: Digest a -> T.Text
100100
encodeBase16 (Digest bs) = T.decodeUtf8 (Base16.encode bs)
101101

102+
-- | Uses "Crypto.Hash.MD5" from cryptohash-md5.
102103
instance 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.
108110
instance 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.
114117
instance ValidAlgo 'SHA256 where
115118
type AlgoCtx 'SHA256 = SHA256.Ctx
116119
initialize = SHA256.init

0 commit comments

Comments
 (0)