File: bench.hs

package info (click to toggle)
haskell-clientsession 0.9.2.0-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 96 kB
  • sloc: haskell: 305; makefile: 5
file content (19 lines) | stat: -rw-r--r-- 491 bytes parent folder | download | duplicates (7)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
import qualified Data.ByteString as B
import Web.ClientSession
import Data.Maybe
import Data.Serialize

import Criterion.Main
import Text.Printf

Right key = initKey (B.replicate 96 0xFE)
Just iv = mkIV (B.replicate 16 0xB0)

main :: IO ()
main =
  defaultMain
    [ bgroup "encrypt then decrypt"
        [ bench (printf "Message length = %d bytes" len) $
          whnf (fromJust . decrypt key . encrypt key iv) (B.replicate len 0xAA)
        | len <- [0, 50, 100, 400, 2000, 80000]]
    ]