commit aa577ad149aff51160175fb6ef1d74c994c89cf6 parent 87cce463a07fd1675e4edcef5b34498570c11503 Author: Jared Tobin <jared@jtobin.io> Date: Sat, 10 Oct 2026 15:24:16 +0400 lib: document hmac Its haddock was a copy of the one for 'hash'. Diffstat:
| M | lib/Crypto/Hash/SHA256.hs | | | 13 | ++++++++----- |
1 file changed, 8 insertions(+), 5 deletions(-)
diff --git a/lib/Crypto/Hash/SHA256.hs b/lib/Crypto/Hash/SHA256.hs @@ -98,13 +98,16 @@ _hash_blocks rs m@(BI.PS _ _ l) = loop rs 0 where -- hmac ---------------------------------------------------------------------- --- | Compute a condensed representation of a strict bytestring via --- SHA-256. +-- | Produce a message authentication code for a strict bytestring, +-- based on the provided (strict, bytestring) key, via SHA-256. -- --- The 256-bit output digest is returned as a strict bytestring. +-- The 256-bit MAC is returned as a strict bytestring. -- --- >>> hash "strict bytestring input" --- "<strict 256-bit message digest>" +-- Per RFC 2104, the key /should/ be a minimum of 32 bytes long. Keys +-- exceeding 64 bytes in length will first be hashed (via SHA-256). +-- +-- >>> hmac "strict bytestring key" "strict bytestring input" +-- "<strict 256-bit MAC>" hmac :: BS.ByteString -> BS.ByteString -> MAC hmac k m | Arm.sha256_arm_available = MAC (Arm.hmac k m)