Hello community,

here is the log from the commit of package ghc-cryptonite-conduit for 
openSUSE:Factory checked in at 2017-03-03 17:49:21
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/ghc-cryptonite-conduit (Old)
 and      /work/SRC/openSUSE:Factory/.ghc-cryptonite-conduit.new (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Package is "ghc-cryptonite-conduit"

Fri Mar  3 17:49:21 2017 rev:2 rq:461621 version:0.2.0

Changes:
--------
--- 
/work/SRC/openSUSE:Factory/ghc-cryptonite-conduit/ghc-cryptonite-conduit.changes
    2016-09-25 14:41:05.000000000 +0200
+++ 
/work/SRC/openSUSE:Factory/.ghc-cryptonite-conduit.new/ghc-cryptonite-conduit.changes
       2017-03-03 17:49:22.288131885 +0100
@@ -1,0 +2,5 @@
+Sun Feb 12 14:11:16 UTC 2017 - [email protected]
+
+- Update to version 0.2.0 with cabal2obs.
+
+-------------------------------------------------------------------

Old:
----
  cryptonite-conduit-0.1.tar.gz

New:
----
  cryptonite-conduit-0.2.0.tar.gz

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Other differences:
------------------
++++++ ghc-cryptonite-conduit.spec ++++++
--- /var/tmp/diff_new_pack.nquqK5/_old  2017-03-03 17:49:22.956037556 +0100
+++ /var/tmp/diff_new_pack.nquqK5/_new  2017-03-03 17:49:22.960036991 +0100
@@ -1,7 +1,7 @@
 #
 # spec file for package ghc-cryptonite-conduit
 #
-# Copyright (c) 2016 SUSE LINUX GmbH, Nuernberg, Germany.
+# Copyright (c) 2017 SUSE LINUX GmbH, Nuernberg, Germany.
 #
 # All modifications and additions to the file contributed by third parties
 # remain the property of their copyright owners, unless otherwise agreed
@@ -17,31 +17,37 @@
 
 
 %global pkg_name cryptonite-conduit
+%bcond_with tests
 Name:           ghc-%{pkg_name}
-Version:        0.1
+Version:        0.2.0
 Release:        0
 Summary:        Cryptonite conduit
 License:        BSD-3-Clause
-Group:          System/Libraries
+Group:          Development/Languages/Other
 Url:            https://hackage.haskell.org/package/%{pkg_name}
 Source0:        
https://hackage.haskell.org/package/%{pkg_name}-%{version}/%{pkg_name}-%{version}.tar.gz
 BuildRequires:  ghc-Cabal-devel
-# Begin cabal-rpm deps:
 BuildRequires:  ghc-bytestring-devel
 BuildRequires:  ghc-conduit-devel
 BuildRequires:  ghc-conduit-extra-devel
 BuildRequires:  ghc-cryptonite-devel
+BuildRequires:  ghc-memory-devel
 BuildRequires:  ghc-resourcet-devel
 BuildRequires:  ghc-rpm-macros
 BuildRequires:  ghc-transformers-devel
 BuildRoot:      %{_tmppath}/%{name}-%{version}-build
-# End cabal-rpm deps
+%if %{with tests}
+BuildRequires:  ghc-conduit-combinators-devel
+BuildRequires:  ghc-tasty-devel
+BuildRequires:  ghc-tasty-hunit-devel
+%endif
 
 %description
 Conduit bridge for cryptonite
 
-For now only provide a conduit version for hash, but with contribution, this
-could provide cipher conduits too, and probably other things.
+For now only provide a conduit version for hash and hmac, but with
+contribution, this could provide cipher conduits too, and probably other
+things.
 
 %package devel
 Summary:        Haskell %{pkg_name} library development files
@@ -58,14 +64,14 @@
 %prep
 %setup -q -n %{pkg_name}-%{version}
 
-
 %build
 %ghc_lib_build
 
-
 %install
 %ghc_lib_install
 
+%check
+%cabal_test
 
 %post devel
 %ghc_pkg_recache

++++++ cryptonite-conduit-0.1.tar.gz -> cryptonite-conduit-0.2.0.tar.gz ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/cryptonite-conduit-0.1/Crypto/MAC/HMAC/Conduit.hs 
new/cryptonite-conduit-0.2.0/Crypto/MAC/HMAC/Conduit.hs
--- old/cryptonite-conduit-0.1/Crypto/MAC/HMAC/Conduit.hs       1970-01-01 
01:00:00.000000000 +0100
+++ new/cryptonite-conduit-0.2.0/Crypto/MAC/HMAC/Conduit.hs     2017-02-06 
10:33:56.000000000 +0100
@@ -0,0 +1,30 @@
+{-# LANGUAGE RankNTypes, BangPatterns #-}
+-- |
+-- Module      : Crypto.MAC.HMAC.Conduit
+-- License     : BSD-style
+-- Maintainer  : Vincent Hanquez <[email protected]>
+-- Stability   : experimental
+-- Portability : unknown
+--
+-- A module containing Conduit facilities for hmac based functions.
+--
+module Crypto.MAC.HMAC.Conduit
+    ( -- * Cryptographic hash functions
+      sinkHMAC
+    ) where
+
+import Crypto.Hash
+import Crypto.MAC.HMAC
+import Data.ByteArray
+import Data.Conduit
+import qualified Data.ByteString as BS
+
+-- | A 'Sink' that calculates HMAC of a stream of 'B.ByteString'@s@ and
+-- returns digest @d@.
+sinkHMAC :: (Monad m, ByteArrayAccess key, HashAlgorithm hash) => key -> 
ConduitM BS.ByteString o m (HMAC hash)
+sinkHMAC key = sink (initialize key)
+  where sink ctx = do
+            b <- await
+            case b of
+                Nothing -> return $! finalize ctx
+                Just bs -> sink $! update ctx bs
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/cryptonite-conduit-0.1/README.md 
new/cryptonite-conduit-0.2.0/README.md
--- old/cryptonite-conduit-0.1/README.md        2016-03-22 20:27:13.000000000 
+0100
+++ new/cryptonite-conduit-0.2.0/README.md      2017-02-06 10:33:56.000000000 
+0100
@@ -1,4 +1,11 @@
-cryptohash-conduit
+cryptonite-conduit
 ==================
 
-Documentation: [cryptohash-conduit on 
hackage](http://hackage.haskell.org/package/cryptohash-conduit)
+[![Join the chat at 
https://gitter.im/vincenthz/cryptonite](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/vincenthz/cryptonite?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
+[![Build 
Status](https://travis-ci.org/haskell-crypto/cryptonite-conduit.png?branch=master)](https://travis-ci.org/haskell-crypto/cryptonite-conduit)
+[![BSD](http://b.repl.ca/v1/license-BSD-blue.png)](http://en.wikipedia.org/wiki/BSD_licenses)
+[![Haskell](http://b.repl.ca/v1/language-haskell-lightgrey.png)](http://haskell.org)
+
+Documentation: [cryptonite-conduit on 
hackage](http://hackage.haskell.org/package/cryptonite-conduit)
+
+Simple conduit wrapper for cryptonite hashes, and maybe further construction 
as needed
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/cryptonite-conduit-0.1/cryptonite-conduit.cabal 
new/cryptonite-conduit-0.2.0/cryptonite-conduit.cabal
--- old/cryptonite-conduit-0.1/cryptonite-conduit.cabal 2016-03-22 
20:27:13.000000000 +0100
+++ new/cryptonite-conduit-0.2.0/cryptonite-conduit.cabal       2017-02-06 
10:34:29.000000000 +0100
@@ -1,10 +1,10 @@
 Name:                cryptonite-conduit
-Version:             0.1
+Version:             0.2.0
 Synopsis:            cryptonite conduit
 Description:
   Conduit bridge for cryptonite
   .
-  For now only provide a conduit version for hash, but
+  For now only provide a conduit version for hash and hmac, but
   with contribution, this could provide cipher conduits too,
   and probably other things.
 License:             BSD3
@@ -20,16 +20,33 @@
 Extra-source-files:  README.md
 
 Library
-  Exposed-modules:   Crypto.Hash.Conduit
+  Exposed-modules:   Crypto.MAC.HMAC.Conduit
+                     Crypto.Hash.Conduit
   Build-depends:     base >= 4 && < 5
                    , bytestring
                    , conduit
-                   , resourcet
                    , conduit-extra
                    , cryptonite
+                   , memory
+                   , resourcet
                    , transformers
   ghc-options:       -Wall -fwarn-tabs
 
+test-suite cryptonite-conduit-test
+  type:                exitcode-stdio-1.0
+  hs-source-dirs:      test
+  main-is:             Spec.hs
+  build-depends:       base
+                     , bytestring
+                     , conduit
+                     , conduit-combinators
+                     , cryptonite
+                     , cryptonite-conduit
+                     , memory
+                     , tasty
+                     , tasty-hunit
+  ghc-options:         -threaded -rtsopts -with-rtsopts=-N -W -Wall
+
 source-repository head
   type: git
   location: https://github.com/haskell-crypto/cryptonite-conduit
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/cryptonite-conduit-0.1/test/Spec.hs 
new/cryptonite-conduit-0.2.0/test/Spec.hs
--- old/cryptonite-conduit-0.1/test/Spec.hs     1970-01-01 01:00:00.000000000 
+0100
+++ new/cryptonite-conduit-0.2.0/test/Spec.hs   2017-02-06 10:33:56.000000000 
+0100
@@ -0,0 +1,27 @@
+{-# Language OverloadedStrings #-}
+import Conduit
+import Crypto.Hash
+import Crypto.MAC.HMAC
+import Crypto.MAC.HMAC.Conduit
+import Data.ByteArray.Encoding
+import Test.Tasty
+import Test.Tasty.HUnit
+import qualified Data.ByteString as BS
+import qualified Data.ByteString.Lazy as BL
+
+main :: IO ()
+main = defaultMain tests
+
+tests :: TestTree
+tests = testGroup "Cryptonite conduit tests"
+    [ testGroup "HMAC"
+        [ testCase "File HMAC is correct" testFileHMAC
+        ]
+    ]
+
+testFileHMAC :: Assertion
+testFileHMAC = do
+    let source = BL.take (1024 * 1024 * 3 + 150) $ BL.iterate (+ 1) 0
+    testhmac <- runConduit $ sourceLazy source $$ sinkHMAC ("foobar" :: 
BS.ByteString)
+    let hexdump = convertToBase Base16 (testhmac :: HMAC SHA512t_256)
+    assertEqual "HMAC mismatch" 
"ab78ef7a3a7b02b2ef50ee1a17e43ae0c134e0bece468b047780626264301831" (hexdump :: 
BS.ByteString)


Reply via email to