packages feed

crypto-cipher-tests 0.0.1 → 0.0.2

raw patch · 2 files changed

+43/−1 lines, 2 filesdep +crypto-cipher-testsdep ~byteablePVP ok

version bump matches the API change (PVP)

Dependencies added: crypto-cipher-tests

Dependency ranges changed: byteable

API changes (from Hackage documentation)

Files

crypto-cipher-tests.cabal view
@@ -1,5 +1,5 @@ Name:                crypto-cipher-tests-Version:             0.0.1+Version:             0.0.2 Synopsis:            Generic cryptography cipher tests Description:         Generic cryptography cipher tests License:             BSD3@@ -29,6 +29,23 @@                    , securemem >= 0.1.1                    , crypto-cipher-types   ghc-options:       -Wall -fwarn-tabs++Test-Suite test-crypto-cipher-dummy+  type:              exitcode-stdio-1.0+  hs-source-dirs:    tests+  Main-is:           Tests.hs+  Build-Depends:     base >= 3 && < 5+                   , bytestring+                   , byteable+                   , crypto-cipher-types+                   , crypto-cipher-tests+                   , mtl+                   , QuickCheck >= 2+                   , HUnit+                   , test-framework+                   , test-framework-quickcheck2+                   , test-framework-hunit+  ghc-options:       -Wall -fno-warn-orphans -fno-warn-missing-signatures  source-repository head   type: git
+ tests/Tests.hs view
@@ -0,0 +1,25 @@+{-# LANGUAGE ViewPatterns #-}+module Main where++import Test.Framework (defaultMain)+import Crypto.Cipher.Types+import Crypto.Cipher.Tests+import qualified Data.ByteString as B+import Data.Bits (xor)++-- | the XOR cipher is so awesome that it doesn't need any key or state.+data XorCipher = XorCipher++instance Cipher XorCipher where+    cipherInit _    = XorCipher+    cipherName _    = "xor"+    cipherKeySize _ = Just 0++instance BlockCipher XorCipher where+    blockSize  _   = 16+    ecbEncrypt _ b = B.pack $ B.zipWith xor (B.replicate (B.length b) 0xa5) b+    ecbDecrypt _ b = B.pack $ B.zipWith xor (B.replicate (B.length b) 0xa5) b++tests = testBlockCipher defaultKATs (undefined :: XorCipher)++main = defaultMain [tests]