drop cipherInit'.

This commit is contained in:
Kei Hibino 2016-06-02 17:05:17 +09:00
parent fce698b821
commit f9c1aa713f

View File

@ -12,13 +12,12 @@
module Crypto.ConstructHash.MiyaguchiPreneel module Crypto.ConstructHash.MiyaguchiPreneel
( mp, mp' ( mp, mp'
, MiyaguchiPreneel , MiyaguchiPreneel
, cipherInit'
) where ) where
import Data.List (foldl') import Data.List (foldl')
import Crypto.Cipher.Types import Crypto.Cipher.Types
import Crypto.Error (eitherCryptoError) import Crypto.Error (throwCryptoError)
import Crypto.Internal.ByteArray (ByteArrayAccess, ByteArray, Bytes) import Crypto.Internal.ByteArray (ByteArrayAccess, ByteArray, Bytes)
import qualified Crypto.Internal.ByteArray as B import qualified Crypto.Internal.ByteArray as B
@ -44,10 +43,6 @@ mp' g = MP . foldl' (step $ g) (B.replicate bsz 0) . chunks . B.convert
where where
(hd, tl) = B.splitAt bsz msg (hd, tl) = B.splitAt bsz msg
-- | Simple key build function, which may raise size error.
cipherInit' :: (ByteArray ba, Cipher k) => ba -> k
cipherInit' = either (error . show) id . eitherCryptoError . cipherInit
-- | Compute Miyaguchi-Preneel one way compress using the infered block cipher. -- | Compute Miyaguchi-Preneel one way compress using the infered block cipher.
-- Only safe when KEY-SIZE equals to BLOCK-SIZE. -- Only safe when KEY-SIZE equals to BLOCK-SIZE.
-- --
@ -55,7 +50,7 @@ cipherInit' = either (error . show) id . eitherCryptoError . cipherInit
mp :: (ByteArrayAccess bin, BlockCipher cipher) mp :: (ByteArrayAccess bin, BlockCipher cipher)
=> bin -- ^ input message => bin -- ^ input message
-> MiyaguchiPreneel cipher -- ^ output tag -> MiyaguchiPreneel cipher -- ^ output tag
mp = mp' cipherInit' mp = mp' $ throwCryptoError . cipherInit
-- | computation step of Miyaguchi-Preneel -- | computation step of Miyaguchi-Preneel
step :: (ByteArray ba, BlockCipher k) step :: (ByteArray ba, BlockCipher k)