Decrypting should work.
[crypto_lab2.git] / labo2-fsharp / CryptoFile / Crypto.fs
index 21b168e..60f9c5f 100644 (file)
@@ -79,4 +79,9 @@ module internal Crypto =
     let HMACStream (key: byte[]) (outputStream: Stream) : Stream * HMACSHA256 = 
         assert (key.Length = 32)
         let hmac = new HMACSHA256 (key)
-        new CryptoStream (outputStream, hmac, CryptoStreamMode.Write) :> Stream, hmac
\ No newline at end of file
+        new CryptoStream (outputStream, hmac, CryptoStreamMode.Write) :> Stream, hmac
+
+    let ComputeHMAC (key: byte[]) (inputStream: Stream) : byte[] =
+        assert (key.Length = 32)
+        let hmac = new HMACSHA256 (key)
+        hmac.ComputeHash inputStream
\ No newline at end of file