commit 503486e6320fd175f6ef28f4bd0bee5dda549f74 parent b7fff78e638b0b09f5c2b02650047641bea91918 Author: Jared Tobin <jared@jtobin.io> Date: Sun, 6 Oct 2024 20:47:52 +0400 lib: haddock hmac args Diffstat:
M | lib/Crypto/Hash/SHA512.hs | | | 10 | ++++++++-- |
1 file changed, 8 insertions(+), 2 deletions(-)
diff --git a/lib/Crypto/Hash/SHA512.hs b/lib/Crypto/Hash/SHA512.hs @@ -505,7 +505,10 @@ hash_lazy bl = cat (go iv (pad_lazy bl)) where -- -- >>> hmac "strict bytestring key" "strict bytestring input" -- "<strict 512-bit MAC>" -hmac :: BS.ByteString -> BS.ByteString -> BS.ByteString +hmac + :: BS.ByteString -- ^ key + -> BS.ByteString -- ^ text + -> BS.ByteString hmac k = hmac_lazy k . BL.fromStrict data KeyAndLen = KeyAndLen @@ -522,7 +525,10 @@ data KeyAndLen = KeyAndLen -- -- >>> hmac_lazy "strict bytestring key" "lazy bytestring input" -- "<strict 512-bit MAC>" -hmac_lazy :: BS.ByteString -> BL.ByteString -> BS.ByteString +hmac_lazy + :: BS.ByteString -- ^ key + -> BL.ByteString -- ^ text + -> BS.ByteString hmac_lazy mk text = let step1 = k <> BS.replicate (128 - lk) 0x00 step2 = BS.map (B.xor 0x36) step1