X-Git-Url: http://git.euphorik.ch/?p=crypto_lab2.git;a=blobdiff_plain;f=labo2-fsharp%2FCryptoFile%2FCrypto.fs;h=60f9c5f6562ad45cbc99edea260da500d7d5175b;hp=21b168ec302c60f98ee154ee7497a9e68b9a4435;hb=0425c0fc231c8a5625bf7ac9b711e152de0eafaa;hpb=ac84e8535149dbf639a7766f110960c998b47159 diff --git a/labo2-fsharp/CryptoFile/Crypto.fs b/labo2-fsharp/CryptoFile/Crypto.fs index 21b168e..60f9c5f 100644 --- a/labo2-fsharp/CryptoFile/Crypto.fs +++ b/labo2-fsharp/CryptoFile/Crypto.fs @@ -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