- new CryptoStream (outputStream, hmac, CryptoStreamMode.Write) :> Stream, hmac
\ No newline at end of file
+ new CryptoStream (outputStream, hmac, CryptoStreamMode.Write) :> Stream, hmac
+
+ /// Compute HMAC-SHA256 for all the data in the input stream.
+ let ComputeHMAC (key: byte[]) (inputStream: Stream) : byte[] =
+ if key.Length <> 32 then raise KeySizeError
+ use hmac = new HMACSHA256 (key)
+ hmac.ComputeHash inputStream
\ No newline at end of file