packages feed

apache-md5 0.5.0.0 → 0.5.0.1

raw patch · 4 files changed

+163/−23 lines, 4 filesPVP ok

version bump matches the API change (PVP)

API changes (from Hackage documentation)

Files

+ ChangeLog.md view
@@ -0,0 +1,30 @@+# ChangeLog / ReleaseNotes+++## Version 0.5.0.1++Release date: **2013-07-27 10:38 +0200**++* Minor release with mostly documentation updates.+* Introducing `example.hs` that creates htpasswd like entry and prints it to+  stdout. (new)+* Updated `README.md` with reference to [Hackage][] and example mentioned+  above.+* Introducing this ChangeLog / ReleaseNotes file. (new)+* Clean up of benchmark dependencies.+* Uploaded to [Hackage][]:+  <http://hackage.haskell.org/package/apache-md5-0.5.0.1>+++## Version 0.5.0.0++Release date: **2013-07-26 20:29 +0200**++* First public release.+* Uploaded to [Hackage][]:+  <http://hackage.haskell.org/package/apache-md5-0.5.0.0>+++[Hackage]:+  http://hackage.haskell.org/+  "HackageDB (or just Hackage) is a collection of releases of Haskell packages."
README.md view
@@ -9,6 +9,12 @@ OpenSSL MD5.  +Documentation+-------------++Stable releases with API documentation are available on [Hackage][].++ Installation ------------ @@ -25,6 +31,65 @@ For details see [HaskellWiki: How to install a Cabal package][].  +Example+-------++Create htpasswd like entry and print it to stdout:++```Haskell+module Main (main)+    where++import Control.Applicative ((<$>))+import System.Environment (getArgs, getProgName)+import System.Exit (exitFailure)+import System.IO (hPutStrLn, stderr)++import Control.Monad.Random (evalRandIO, getRandomRs)+    -- MonadRandom package http://hackage.haskell.org/package/MonadRandom/+import Data.ByteString (ByteString)+import qualified Data.ByteString as BS (index, pack)+import qualified Data.ByteString.Char8 as C8 (concat, pack, putStrLn, singleton)+    -- bytestring package http://hackage.haskell.org/package/bytestring+import Data.Digest.ApacheMD5 (alpha64, apacheMD5)+++htpasswdEntry :: String -> String -> ByteString -> ByteString+htpasswdEntry username password salt = C8.concat+    [ C8.pack username+    , C8.pack ":$apr1$"+    , salt+    , C8.singleton '$'+    , apacheMD5 (C8.pack password) salt+    ]++genSalt :: IO ByteString+genSalt = evalRandIO+    $ BS.pack . map (BS.index alpha64) . take 8 <$> getRandomRs (0, 63)++main :: IO ()+main = do+    args <- getArgs+    progName <- getProgName+    case args of+        [userName, password] ->+            genSalt >>= C8.putStrLn . htpasswdEntry userName password+        _ -> do+            hPutStrLn stderr $ "Usage: " ++ progName ++ " USER_NAME PASSWORD"+            exitFailure+```++Compiling and running above example:++    $ ghc -Wall example.hs+    [1 of 1] Compiling Main             ( example.hs, example.o )+    Linking example ...+    $ ./example+    Usage: example USER_NAME PASSWORD+    $ ./example foo 123456+    foo:$apr1$yM9AMlr2$EHssuHrqSAe8HPrAdN7HC/++ Unit Tests ---------- @@ -56,6 +121,8 @@     http://packages.debian.org/lenny/libssl-dev [cabal-install]:     http://haskell.org/haskellwiki/Cabal-Install+[Hackage]:+    http://hackage.haskell.org/package/apache-md5 [HaskellWiki: How to install a Cabal package]:     http://haskell.org/haskellwiki/Cabal/How_to_install_a_Cabal_package [apache2-utils]:
apache-md5.cabal view
@@ -1,19 +1,29 @@ name:                 apache-md5-version:              0.5.0.0-synopsis:             Apache server specific MD5 digest algorighm.+version:              0.5.0.1+synopsis:             Apache specific MD5 digest algorighm. description:   Haskell implementation of Apache HTTP server specific MD5 digest algorithm   that uses OpenSSL @MD5()@ function.+  .+  README and ChangeLog can be found in source code package and on GitHub:+  .+  * <https://github.com/trskop/apache-md5/blob/master/README.md>+  .+  * <https://github.com/trskop/apache-md5/blob/master/ChangeLog.md>+ license:              BSD3 license-File:         LICENSE-copyright:            2009, 2010, 2012, 2013 Peter Trško+copyright:            (c) 2009, 2010, 2012, 2013 Peter Trško author:               Peter Trško <peter.trsko@gmail.com> maintainer:           peter.trsko@gmail.com category:             Data, Cryptography build-Type:           Custom cabal-Version:        >= 1.9.1   -- Benchmark section is available since Cabal >= 1.9.1-extra-source-files:   README.md+extra-source-files:+    ChangeLog.md+  , README.md+  , example.hs   flag pedantic@@ -96,24 +106,6 @@     , criterion     , MonadRandom -    -- Test dependencies:-    , HUnit >= 1.2 && < 2-      -- ^ Same constraints as test-framework-hunit- -- , QuickCheck >= 2.4 && < 2.6-      -- ^ Same constraints as test-framework-quickcheck2-    , test-framework >= 0.8 && < 1-      -- ^ Same constraint as test-framework-skip, other packages that-      -- depend on it have less restrictive bounds.-    , test-framework-hunit >= 0.2.6-      -- ^ Lower versions have more restrictive bounds on test-framework.- -- , test-framework-quickcheck2 >= 0.3-      -- ^ There were changes in QuickCheck bounds in 0.2 branch and last one-      -- on it had a compilation failure on Hackage.--      -- Not required right now:- -- , test-framework-skip == 1.*-      -- ^ Currently there is only version 1.0.-   includes:             openssl/md5.h   extra-libraries:      crypto @@ -130,4 +122,4 @@ source-repository this   type:                 git   location:             git://github.com/trskop/apache-md5.git-  tag:                  v0.5.0.0+  tag:                  v0.5.0.1
+ example.hs view
@@ -0,0 +1,51 @@+-- |+-- Module:       Main+-- Description:  Create htpasswd like entry and print it to stdout.+-- Copyright:    (c) 2013 Peter Trsko+-- License:      BSD3+--+-- Maintainer:   peter.trsko@gmail.com+-- Stability:    stable+-- Portability:  portable+--+-- Create htpasswd like entry and print it to stdout.+module Main (main)+    where++import Control.Applicative ((<$>))+import System.Environment (getArgs, getProgName)+import System.Exit (exitFailure)+import System.IO (hPutStrLn, stderr)++import Control.Monad.Random (evalRandIO, getRandomRs)+    -- MonadRandom package http://hackage.haskell.org/package/MonadRandom/+import Data.ByteString (ByteString)+import qualified Data.ByteString as BS (index, pack)+import qualified Data.ByteString.Char8 as C8 (concat, pack, putStrLn, singleton)+    -- bytestring package http://hackage.haskell.org/package/bytestring+import Data.Digest.ApacheMD5 (alpha64, apacheMD5)+++htpasswdEntry :: String -> String -> ByteString -> ByteString+htpasswdEntry username password salt = C8.concat+    [ C8.pack username+    , C8.pack ":$apr1$"+    , salt+    , C8.singleton '$'+    , apacheMD5 (C8.pack password) salt+    ]++genSalt :: IO ByteString+genSalt = evalRandIO+    $ BS.pack . map (BS.index alpha64) . take 8 <$> getRandomRs (0, 63)++main :: IO ()+main = do+    args <- getArgs+    progName <- getProgName+    case args of+        [userName, password] ->+            genSalt >>= C8.putStrLn . htpasswdEntry userName password+        _ -> do+            hPutStrLn stderr $ "Usage: " ++ progName ++ " USER_NAME PASSWORD"+            exitFailure