Main.hs (1105B)
1 {-# OPTIONS_GHC -fno-warn-missing-signatures #-} 2 {-# LANGUAGE BangPatterns #-} 3 {-# LANGUAGE OverloadedStrings #-} 4 5 module Main where 6 7 import Criterion.Main 8 import qualified Crypto.DRBG.HMAC.SHA256 as DRBG256 9 import qualified Crypto.DRBG.HMAC.SHA512 as DRBG512 10 11 main :: IO () 12 main = do 13 !drbg256 <- DRBG256.new mempty mempty mempty 14 !drbg512 <- DRBG512.new mempty mempty mempty 15 defaultMain [ 16 suite drbg256 drbg512 17 ] 18 19 suite drbg256 drbg512 = 20 bgroup "ppad-hmac-drbg" [ 21 bgroup "HMAC-SHA256" [ 22 bench "new" $ whnfAppIO (DRBG256.new mempty mempty) mempty 23 , bench "reseed" $ whnfAppIO (DRBG256.reseed drbg256 mempty) mempty 24 , bench "gen (32B)" $ whnfAppIO (DRBG256.gen drbg256 mempty) 32 25 , bench "gen (256B)" $ whnfAppIO (DRBG256.gen drbg256 mempty) 256 26 ] 27 , bgroup "HMAC-SHA512" [ 28 bench "new" $ whnfAppIO (DRBG512.new mempty mempty) mempty 29 , bench "reseed" $ whnfAppIO (DRBG512.reseed drbg512 mempty) mempty 30 , bench "gen (32B)" $ whnfAppIO (DRBG512.gen drbg512 mempty) 32 31 , bench "gen (256B)" $ whnfAppIO (DRBG512.gen drbg512 mempty) 256 32 ] 33 ] 34