From 285d9fb433668fb53af993179fc0178a76d54d79 Mon Sep 17 00:00:00 2001 From: Kei Hibino Date: Thu, 7 Apr 2016 14:43:44 +0900 Subject: [PATCH] Specify each chunk type. --- Crypto/ConstructHash/MiyaguchiPreneel.hs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Crypto/ConstructHash/MiyaguchiPreneel.hs b/Crypto/ConstructHash/MiyaguchiPreneel.hs index 585b4f9..a49a33b 100644 --- a/Crypto/ConstructHash/MiyaguchiPreneel.hs +++ b/Crypto/ConstructHash/MiyaguchiPreneel.hs @@ -14,7 +14,7 @@ import Data.List (foldl') import Crypto.Cipher.Types import Crypto.Error (eitherCryptoError) -import Crypto.Internal.ByteArray (ByteArrayAccess, ByteArray) +import Crypto.Internal.ByteArray (ByteArrayAccess, ByteArray, Bytes) import qualified Crypto.Internal.ByteArray as B @@ -24,11 +24,11 @@ mp :: (ByteArrayAccess bin, ByteArray bout, ByteArray ba, BlockCipher cipher) => (ba -> cipher) -- ^ key build function to compute Miyaguchi-Preneel -> bin -- ^ input message -> bout -- ^ output tag -mp g = B.convert . foldl' (step g) (B.replicate bsz 0) . chunks . B.convert +mp g = B.convert . foldl' (step $ g . B.convert) (B.replicate bsz 0) . chunks . B.convert where bsz = blockSize ( g B.empty {- dummy to get block size -} ) chunks msg - | B.null tl = [hd] + | B.null tl = [hd :: Bytes] | otherwise = hd : chunks tl where (hd, tl) = B.splitAt bsz msg