packages feed

password 3.0.4.0 → 3.1.0.0

raw patch · 5 files changed

+37/−21 lines, 5 filesdep −password

Dependencies removed: password

Files

ChangeLog.md view
@@ -1,5 +1,13 @@ # Changelog for `password` +## 3.1.0.0++-   Switched default cryptographic backend library from `cryptonite` to `crypton`.+    The `crypton` flag is now a no-op, and the `cryptonite` flag is needed to build+    the `password` library using the `cryptonite` library.+    Thanks to [@Vlix](https://github.com/Vlix)+    [#81](https://github.com/cdepillabout/password/pull/81)+ ## 3.0.4.0  -   Support `base64` package up to and including `base64-1.0`.
password.cabal view
@@ -1,7 +1,7 @@ cabal-version: 1.12  name:           password-version:        3.0.4.0+version:        3.1.0.0 category:       Data synopsis:       Hashing and checking of passwords description:@@ -58,13 +58,13 @@  flag crypton   description: Use the [crypton] library as the cryptographic backend.+    (Does nothing since version 3.1.0.0; might be removed in a future major version)   default: False   manual: True  flag cryptonite   description:     Use the [cryptonite] library as the cryptographic backend.-    (Does nothing until a future major version)   default: False   manual: True @@ -120,15 +120,12 @@       -Wall   default-language:       Haskell2010-  -- At some future major version bump, this should-  -- be changed to the [cryptonite] flag and that-  -- `if flag(cryptonite) build-depends: cryptonite`-  if flag(crypton)+  if flag(cryptonite)     build-depends:-      crypton     >= 0.31   && < 0.35+      cryptonite  >= 0.15.1   && < 0.31   else     build-depends:-      cryptonite  >= 0.15.1   && < 0.31+      crypton     >= 0.31   && < 1.1  test-suite doctests   type:@@ -143,10 +140,8 @@       base >=4.9 && <5     , base-compat     , doctest-    , password     , QuickCheck     , quickcheck-instances-    , template-haskell   default-language:       Haskell2010 @@ -195,7 +190,6 @@     , bytestring     , memory     , quickcheck-instances-    , scrypt     , tasty     , tasty-hunit     , tasty-quickcheck@@ -203,6 +197,12 @@     , text   default-language:       Haskell2010++  if os(darwin)+    cpp-options: -DIS_MAC_OS+  else+    build-depends: scrypt+   if flag(argon2)     cpp-options:       -DCABAL_FLAG_argon2@@ -215,12 +215,9 @@   if flag(scrypt)     cpp-options:       -DCABAL_FLAG_scrypt-  -- At some future major version bump, this should-  -- be changed to the [cryptonite] flag and that-  -- `if flag(cryptonite) build-depends: cryptonite`-  if flag(crypton)+  if flag(cryptonite)     build-depends:-      crypton+      cryptonite   else     build-depends:-      cryptonite+      crypton
src/Data/Password/Bcrypt.hs view
@@ -221,8 +221,11 @@ extractParams :: PasswordHash Bcrypt -> Maybe Int extractParams (PasswordHash passHash) =   case T.split (== '$') passHash of-    [_, version, cost, _pass] -> do-      guard $ elem version $ map T.pack ["2", "2a", "2x", "2y", "2b"]+    [prefix, version, cost, _pass] -> do+      guard $+        -- 'prefix' should be nothing, because the hash should start with a '$'+        -- The order of versions is based on most likely to encounter in the wild.+        T.null prefix && elem version (T.pack <$> ["2b", "2y", "2x", "2a", "2"])       readMaybe $ T.unpack cost     _ -> Nothing 
src/Data/Password/Validate.hs view
@@ -202,8 +202,9 @@  import Data.Char (chr, isAsciiLower, isAsciiUpper, isDigit, ord) import Data.Function (on)-import Data.List (foldl')-+#if !MIN_VERSION_base(4,20,0)+import Data.Foldable (foldl')+#endif import Data.Text (Text) import qualified Data.Text as T import Language.Haskell.TH (Exp, Q, appE)
test/tasty/Scrypt.hs view
@@ -1,3 +1,4 @@+{-# LANGUAGE CPP #-} module Scrypt where  import Data.Maybe (fromJust)@@ -7,7 +8,9 @@ import Test.Tasty.QuickCheck import Test.QuickCheck.Instances.Text () +#ifndef IS_MAC_OS import qualified Crypto.Scrypt as Scrypt+#endif import Data.Password.Types import Data.Password.Scrypt @@ -24,7 +27,9 @@                  checkPassword                  extractParams                  testsParams8Rounds+#ifndef IS_MAC_OS   , testProperty "scrypt <-> cryptonite" $ withMaxSuccess 10 checkScrypt+#endif   ]   where     hash8Rounds = hashPasswordWithParams testsParams8Rounds@@ -32,6 +37,7 @@     hash4Rounds = hashPasswordWithParams testsParams4Rounds     testsParams4Rounds = defaultParams{ scryptRounds = 4, scryptSalt = 16 } +#ifndef IS_MAC_OS checkScrypt :: Text -> Property checkScrypt pass = ioProperty $ do   s@(Scrypt.Salt salt) <- Scrypt.newSalt@@ -41,3 +47,4 @@       PasswordHash ourHash =         hashPasswordWithSalt defaultParams{ scryptRounds = 8 } (Salt salt) $ mkPassword pass   return $ scryptHash === encodeUtf8 ourHash+#endif