saltine 0.1.1.0 → 0.1.1.1
raw patch · 4 files changed
+55/−3 lines, 4 filesdep ~profunctorsPVP ok
version bump matches the API change (PVP)
Dependency ranges changed: profunctors
API changes (from Hackage documentation)
Files
- CHANGELOG.md +5/−0
- README.md +1/−1
- saltine.cabal +3/−2
- tests/HashProperties.hs +46/−0
CHANGELOG.md view
@@ -5,6 +5,11 @@ ## [Unreleased] +## [0.1.1.1] - 2021-01-15+### Changed+- Fix for running tests in `cabal repl` (thanks [@timds])+- Allow newer profunctors+ ## [0.1.1.0] - 2020-02-29 ### Added - bindings to generichash (Blake2), thanks [@donatello](https://github.com/donatello)
README.md view
@@ -1,4 +1,4 @@-# Saltine 0.1.1.0 [](https://travis-ci.org/tel/saltine)[](https://hackage.haskell.org/package/saltine)+# Saltine 0.1.1.1 [](https://travis-ci.org/tel/saltine)[](https://hackage.haskell.org/package/saltine) A Haskell binding for @jedisct1's portable binding for djb's NaCl. **This is an early release.** Please try it out, but don't just
saltine.cabal view
@@ -1,5 +1,5 @@ name: saltine-version: 0.1.1.0+version: 0.1.1.1 synopsis: Cryptography that's easy to digest (NaCl/libsodium bindings). description: @@ -67,7 +67,7 @@ build-depends: base >= 4.5 && < 5 , bytestring >= 0.10.8 && < 0.11- , profunctors >= 5.3 && < 5.6+ , profunctors >= 5.3 && < 5.7 , hashable test-suite tests@@ -76,6 +76,7 @@ other-modules: AuthProperties BoxProperties+ HashProperties OneTimeAuthProperties ScalarMultProperties SecretBoxProperties
+ tests/HashProperties.hs view
@@ -0,0 +1,46 @@+{-# LANGUAGE OverloadedStrings #-}++module HashProperties (+ testHash+ ) where++import Util+import Crypto.Saltine.Core.Hash++import qualified Data.ByteString as S+import Test.Framework.Providers.QuickCheck2+import Test.Framework+import Test.QuickCheck++testHash :: Test+testHash = buildTest $ do+ shKey <- newShorthashKey+ shKey2 <- newShorthashKey+ ghKey <- newGenerichashKey 24 >>= maybe undefined return+ ghKey2 <- newGenerichashKey 24 >>= maybe undefined return+ let ghOutLen = maybe undefined id $ generichashOutLen 32++ return $ testGroup "...Internal.Hash" [++ testProperty "No two hashes are alike"+ $ \(Message bs1, Message bs2) -> bs1 /= bs2 ==> hash bs1 /= hash bs2,++ testProperty "Hash of empty ByteString is correct"+ $ \(Message bs) -> (bs == S.empty) ==> hash bs == (read hashEmptyBS :: S.ByteString),++ testProperty "No two shorthashes are alike"+ $ \(Message bs1, Message bs2) -> bs1 /= bs2 ==> shorthash shKey bs1 /= shorthash shKey bs2,++ testProperty "Different keys produce different shorthashes"+ $ \(Message bs) -> shorthash shKey bs /= shorthash shKey2 bs,++ testProperty "No two generic hashes are alike"+ $ \(Message bs1, Message bs2) -> bs1 /= bs2 ==> generichash ghKey bs1 ghOutLen /= generichash ghKey bs2 ghOutLen,++ testProperty "Different keys produce different generichashes"+ $ \(Message bs) -> generichash ghKey bs ghOutLen /= generichash ghKey2 bs ghOutLen++ ]++ where+ hashEmptyBS = "\"\207\131\225\&5~\239\184\189\241T(P\214m\128\a\214 \228\ENQ\vW\NAK\220\131\244\169!\211l\233\206G\208\209<]\133\242\176\255\131\CAN\210\135~\236/c\185\&1\189GAz\129\165\&82z\249'\218>\""