cipher-aes128 0.4 → 0.4.1
raw patch · 3 files changed
+12/−11 lines, 3 filessetup-changedPVP ok
version bump matches the API change (PVP)
API changes (from Hackage documentation)
Files
- Benchmark/bench.hs +9/−2
- Setup.hs +2/−8
- cipher-aes128.cabal +1/−1
Benchmark/bench.hs view
@@ -1,13 +1,20 @@ import Crypto.Cipher.AES128+import Crypto.Cipher.AES import Crypto.Classes import Crypto.Modes (zeroIV) import Criterion import Criterion.Main import System.Entropy+import Data.Serialize+import qualified Data.ByteString as B main = do let iv = zeroIV- pt <- getEntropy (2^20)+ ivV = IV (B.replicate 16 0)+ pt <- getEntropy (2^12) k <- buildKeyIO :: IO AESKey+ let kV = initKey (B.pack [0..15]) defaultMain- [ bench "aes-ctr" $ nf (fst . ctr k iv) pt ]+ [ bench "aes-ctr cipher-aes128" $ nf (fst . ctr k iv) pt+ , bench "aes-ctr cipher-aes" $ nf (encryptCTR kV ivV) pt+ , bench "aes-gcm cipher-aes" $ nf (encryptGCM kV ivV B.empty) pt]
Setup.hs view
@@ -1,4 +1,3 @@-{-# LANGUAGE TemplateHaskell #-} import Distribution.Simple import Distribution.Simple.LocalBuildInfo import Distribution.Simple.Setup@@ -9,7 +8,6 @@ import System.Process import System.Directory import System.Exit-import Language.Haskell.TH (appE, varE, mkName, conE) main = defaultMainWithHooks hk where@@ -32,12 +30,8 @@ aesArgsHC = map ("-optc" ++) aesArgs canUseAesIntrinsicsFlag :: FilePath -> IO Bool-canUseAesIntrinsicsFlag cc =- -- withTempDirectory normal False "" "testRDRAND" $ \tmpDir -> do- $(if cabalVersion >= Version [1,17,0] []- then appE (appE (varE $ mkName "withTempDirectory") (varE 'normal)) (conE (mkName "False"))- else appE (varE $ mkName "withTempDirectory") (varE 'normal)) "" "testRDRAND" $ \tmpDir -> do-+canUseAesIntrinsicsFlag cc = do+ withTempDirectory normal "" "testIntrinsic" $ \tmpDir -> do writeFile (tmpDir ++ "/testIntrinsic.c") (unlines [ "#include <wmmintrin.h>" , "int main() {"
cipher-aes128.cabal view
@@ -2,7 +2,7 @@ -- documentation, see http://haskell.org/cabal/users-guide/ name: cipher-aes128-version: 0.4+version: 0.4.1 synopsis: AES128 using AES-NI when available. description: AES128 with crypto-api instances and a trampoline between Vincent Hanquez's C-based and x86 NI-based AES. Patches welcome to add additional high-performance backends (ARM?) license: BSD3