diff --git a/Crypto/Hash.hs b/Crypto/Hash.hs index de7cbc0..f8b9637 100644 --- a/Crypto/Hash.hs +++ b/Crypto/Hash.hs @@ -42,8 +42,8 @@ module Crypto.Hash ) where import Basement.Types.OffsetSize (CountOf (..)) -import Basement.UArray (UArray, new, unsafeFreeze) -import Basement.UArray.Mutable (copyFromPtr) +import Basement.Block (Block, unsafeFreeze) +import Basement.Block.Mutable (copyFromPtr, new) import Control.Monad import Crypto.Internal.Compat (unsafeDoIO) import Crypto.Hash.Types @@ -115,10 +115,10 @@ digestFromByteString = from undefined | B.length bs == (hashDigestSize alg) = Just $ Digest $ unsafeDoIO $ copyBytes bs | otherwise = Nothing - copyBytes :: ba -> IO (UArray Word8) + copyBytes :: ba -> IO (Block Word8) copyBytes ba = do muArray <- new count - B.withByteArray ba $ \ptr -> copyFromPtr ptr count muArray + B.withByteArray ba $ \ptr -> copyFromPtr ptr muArray 0 count unsafeFreeze muArray where count = CountOf (B.length ba) diff --git a/Crypto/Hash/Types.hs b/Crypto/Hash/Types.hs index 7cc7e30..7cc2979 100644 --- a/Crypto/Hash/Types.hs +++ b/Crypto/Hash/Types.hs @@ -20,7 +20,7 @@ import Crypto.Internal.Imports import Crypto.Internal.ByteArray (ByteArrayAccess, Bytes) import qualified Crypto.Internal.ByteArray as B import Foreign.Ptr (Ptr) -import Basement.UArray (UArray) +import Basement.Block (Block) import Basement.NormalForm (deepseq) import GHC.TypeLits (Nat) @@ -70,7 +70,7 @@ newtype Context a = Context Bytes -- -- Creating a digest from a bytearray is also possible with function -- 'Crypto.Hash.digestFromByteString'. -newtype Digest a = Digest (UArray Word8) +newtype Digest a = Digest (Block Word8) deriving (Eq,Ord,ByteArrayAccess) instance NFData (Digest a) where diff --git a/cryptonite.cabal b/cryptonite.cabal index 001d917..1e1fecf 100644 --- a/cryptonite.cabal +++ b/cryptonite.cabal @@ -227,8 +227,8 @@ Library Crypto.Internal.Nat Build-depends: base >= 4.6 && < 5 , bytestring - , memory >= 0.14.10 - , basement + , memory >= 0.14.14 + , basement >= 0.0.6 , ghc-prim ghc-options: -Wall -fwarn-tabs -optc-O3 -fno-warn-unused-imports if os(linux)