hwsl2 0.3.2.0 → 0.4.0.0
raw patch · 8 files changed
+37/−42 lines, 8 filesdep +tastydep +tasty-quickcheckdep −QuickCheckdep −cabal-test-quickcheckdep ~basedep ~bytestringdep ~criterionPVP ok
version bump matches the API change (PVP)
Dependencies added: tasty, tasty-quickcheck
Dependencies removed: QuickCheck, cabal-test-quickcheck
Dependency ranges changed: base, bytestring, criterion, cryptohash, parallel, quickcheck-properties
API changes (from Hackage documentation)
- Data.Hash.SL2: instance Eq Hash
- Data.Hash.SL2: instance Monoid Hash
- Data.Hash.SL2: instance Ord Hash
- Data.Hash.SL2: instance Show Hash
- Data.Hash.SL2.Chunk: getChunkBytes :: Chunk -> ByteString
- Data.Hash.SL2.Chunk: getChunkHash :: Chunk -> Hash
- Data.Hash.SL2.Chunk: instance Eq Chunk
- Data.Hash.SL2.Chunk: instance Monoid Chunk
- Data.Hash.SL2.Chunk: instance Ord Chunk
- Data.Hash.SL2.Unsafe: instance Storable Hash
+ Data.Hash.SL2: instance GHC.Base.Monoid Data.Hash.SL2.Internal.Hash
+ Data.Hash.SL2: instance GHC.Classes.Eq Data.Hash.SL2.Internal.Hash
+ Data.Hash.SL2: instance GHC.Classes.Ord Data.Hash.SL2.Internal.Hash
+ Data.Hash.SL2: instance GHC.Show.Show Data.Hash.SL2.Internal.Hash
+ Data.Hash.SL2.Chunk: [getChunkBytes] :: Chunk -> ByteString
+ Data.Hash.SL2.Chunk: [getChunkHash] :: Chunk -> Hash
+ Data.Hash.SL2.Chunk: instance GHC.Base.Monoid Data.Hash.SL2.Chunk.Chunk
+ Data.Hash.SL2.Chunk: instance GHC.Classes.Eq Data.Hash.SL2.Chunk.Chunk
+ Data.Hash.SL2.Chunk: instance GHC.Classes.Ord Data.Hash.SL2.Chunk.Chunk
+ Data.Hash.SL2.Unsafe: instance Foreign.Storable.Storable Data.Hash.SL2.Internal.Hash
Files
- README.md +1/−1
- hwsl2.cabal +14/−15
- src/Data/Hash/SL2.hs +7/−9
- src/Data/Hash/SL2/Benchmark.hs +1/−3
- src/Data/Hash/SL2/Internal.hs +1/−1
- src/Data/Hash/SL2/Mutable.hs +2/−2
- src/Data/Hash/SL2/Test.hs +10/−10
- src/Data/Hash/SL2/Unsafe.hs +1/−1
README.md view
@@ -1,4 +1,4 @@-# Hashing with SL2+# Hashing with SL2 [](https://travis-ci.org/srijs/hwsl2-haskell) An algebraic hash function, inspired by the paper _Hashing with SL2_ by Tillich and Zemor.
hwsl2.cabal view
@@ -10,7 +10,7 @@ -- PVP summary: +-+------- breaking API changes -- | | +----- non-breaking API additions -- | | | +--- code changes with no API change-version: 0.3.2.0+version: 0.4.0.0 -- A short (one-line) description of the package. synopsis: Hashing with SL2@@ -85,7 +85,7 @@ Safe Trustworthy Unsafe -- Other library packages from which modules are imported.- build-depends: base >=4.7 && <4.8, bytestring >=0.10 && <0.11+ build-depends: base >=4.8 && <4.9, bytestring >=0.10 -- Directories containing source files. hs-source-dirs: src@@ -106,19 +106,18 @@ test-suite test- type: detailed-0.9+ type: exitcode-stdio-1.0 hs-source-dirs: src- test-module: Data.Hash.SL2.Test+ main-is: Data/Hash/SL2/Test.hs other-modules: Data.Hash.SL2 Data.Hash.SL2.Mutable Data.Hash.SL2.Unsafe Data.Hash.SL2.Internal- build-depends: base >=4.7 && <4.8,- Cabal >=1.9.2,- bytestring >=0.10 && <0.11,- QuickCheck >=2.7 && <2.8,- quickcheck-properties>=0.1 && <0.2,- cabal-test-quickcheck>=0.1 && <0.2+ build-depends: base >=4.8 && <4.9,+ bytestring >=0.10,+ tasty >=0.10,+ tasty-quickcheck >=0.8,+ quickcheck-properties >= 0.1 include-dirs: src/core if flag(avx2) cc-options: -Wall -O3 -mavx2 -msse4.1 -msse2 -mpclmul@@ -135,12 +134,12 @@ Data.Hash.SL2.Mutable Data.Hash.SL2.Unsafe Data.Hash.SL2.Internal- build-depends: base >=4.7 && <4.8,+ build-depends: base >=4.8 && <4.9, Cabal >=1.9.2,- bytestring >=0.10 && <0.11,- criterion >=1.0 && <1.1,- cryptohash >=0.11 && <0.12,- parallel >=3.2 && <3.3+ bytestring >=0.10,+ criterion >=1.0,+ cryptohash >=0.11,+ parallel >=3.2 include-dirs: src/core if flag(avx2) cc-options: -Wall -O3 -mavx2 -msse4.1 -msse2 -mpclmul
src/Data/Hash/SL2.hs view
@@ -43,7 +43,7 @@ , unpack8, unpack16, unpack32, unpack64 ) where -import Prelude hiding (concat, foldl, foldr)+import Prelude hiding (concat) import Data.Hash.SL2.Internal (Hash) import Data.Hash.SL2.Unsafe@@ -54,9 +54,7 @@ import Data.ByteString (ByteString) import Data.Word-import Data.Monoid-import Data.Functor-import Data.Foldable (Foldable, foldl, foldl', foldr, foldr')+import Data.Foldable (foldl', foldr') instance Show Hash where show h = unsafePerformIO $ unsafeUseAsPtr h Mutable.serialize@@ -120,7 +118,7 @@ -- | /O(1)/ Parse the representation generated by 'show'. parse :: String -> Maybe Hash-parse s = (\(h, r) -> h <$ r) $ unsafePerformIO $ unsafeWithNew $ Mutable.unserialize s+parse s = uncurry (<$) $ unsafePerformIO $ unsafeWithNew $ Mutable.unserialize s -- | /O(1)/ Check a hash for bit-level validity. valid :: Hash -> Bool@@ -153,16 +151,16 @@ -- | /O(1)/ Unpack into list of 64 8-bit words. unpack8 :: Hash -> [Word8]-unpack8 h = unsafeUnpack h+unpack8 = unsafeUnpack -- | /O(1)/ Unpack into list of 32 16-bit words. unpack16 :: Hash -> [Word16]-unpack16 h = unsafeUnpack h+unpack16 = unsafeUnpack -- | /O(1)/ Unpack into list of 16 32-bit words. unpack32 :: Hash -> [Word32]-unpack32 h = unsafeUnpack h+unpack32 = unsafeUnpack -- | /O(1)/ Unpack into list of 8 64-bit words. unpack64 :: Hash -> [Word64]-unpack64 h = unsafeUnpack h+unpack64 = unsafeUnpack
src/Data/Hash/SL2/Benchmark.hs view
@@ -6,7 +6,6 @@ import qualified Data.ByteString as B import qualified Crypto.Hash.SHA256 as SHA256-import qualified Crypto.Hash.SHA512 as SHA512 import Criterion.Main @@ -17,7 +16,6 @@ main = defaultMain [ bench "hwsl2 append" $ whnf (append unit) bs4M , bench "hwsl2 prepend" $ whnf (flip prepend unit) bs4M- , bench "hwsl2 append parallel" $ whnf (concatAll . (parMap rpar hash)) [bs1M, bs1M, bs1M, bs1M]+ , bench "hwsl2 append parallel" $ whnf (concatAll . parMap rpar hash) [bs1M, bs1M, bs1M, bs1M] , bench "sha256" $ whnf SHA256.hash bs4M- , bench "sha512" $ whnf SHA512.hash bs4M ]
src/Data/Hash/SL2/Internal.hs view
@@ -4,7 +4,7 @@ module Data.Hash.SL2.Internal where -import Foreign.Safe+import Foreign import Foreign.C.Types newtype Hash = H (ForeignPtr ())
src/Data/Hash/SL2/Mutable.hs view
@@ -13,13 +13,13 @@ import Prelude hiding (concat) -import Foreign.Safe+import Foreign import Foreign.C.String import Data.ByteString (ByteString) import Data.ByteString.Unsafe -import Data.Foldable (Foldable, foldlM, foldrM)+import Data.Foldable (foldlM, foldrM) import Data.Hash.SL2.Internal (Hash, hashLen) import qualified Data.Hash.SL2.Internal as Internal
src/Data/Hash/SL2/Test.hs view
@@ -1,4 +1,4 @@-module Data.Hash.SL2.Test where+{-# LANGUAGE ScopedTypeVariables #-} import Prelude hiding (concat) @@ -10,14 +10,12 @@ import qualified Data.ByteString as B -import Foreign.Safe+import Foreign -import Test.QuickCheck-import Test.QuickCheck.All+import Test.Tasty+import Test.Tasty.QuickCheck as QC import Test.QuickCheck.Property.Monoid -import Distribution.TestSuite.QuickCheck- import Data.Monoid instance Arbitrary B.ByteString where@@ -26,9 +24,11 @@ instance Arbitrary Hash where arbitrary = fmap hash arbitrary -tests :: IO [Test]-tests = return+main = defaultMain tests +tests :: TestTree+tests = testGroup "Properties"+ [ testGroup "equality" [ testProperty "true" $@@ -104,7 +104,7 @@ , testGroup "multiple strings" $ [ testProperty "equal to (foldl append)" $- \a b -> (foldl append) a b == a `foldAppend` b+ \a (b :: [B.ByteString]) -> foldl append a b == a `foldAppend` b ] ]@@ -120,7 +120,7 @@ , testGroup "multiple strings" $ [ testProperty "equal to (flip (foldr prepend)" $- \a b -> (flip (foldr prepend)) a b == a `foldPrepend` b+ \(a :: [B.ByteString]) b -> foldr prepend b a == a `foldPrepend` b ] ]
src/Data/Hash/SL2/Unsafe.hs view
@@ -2,7 +2,7 @@ module Data.Hash.SL2.Unsafe (unsafeUseAsPtr, unsafeUseAsPtr2, unsafeWithNew, unsafePack, unsafeUnpack) where -import Foreign.Safe+import Foreign import System.IO.Unsafe import Data.Hash.SL2.Internal (Hash(H), hashSize)