forked from RNCryptor/rncryptor-hs
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
36 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
{-# LANGUAGE OverloadedStrings #-} | ||
module Main where | ||
|
||
import Criterion.Main | ||
import Crypto.RNCryptor.Types | ||
import Crypto.RNCryptor.V3.Encrypt | ||
import Data.ByteString as B | ||
|
||
encryptBench :: ByteString -> ByteString | ||
encryptBench input = | ||
let eSalt = B.pack [0,1,2,3,4,5,6,7] | ||
hSalt = B.pack [1,2,3,4,5,6,7,8] | ||
iv = B.pack [2,3,4,5,6,7,8,9,10,11,12,13,14,15,0,1] | ||
header = newRNCryptorHeaderFrom eSalt hSalt iv | ||
ctx = newRNCryptorContext "password" header | ||
in encrypt ctx input | ||
|
||
main :: IO () | ||
main = defaultMain [ | ||
bgroup "encryption" [ bench "simple encryption" $ nf encryptBench "bench" | ||
, bench "long encryption" $ nf encryptBench (B.pack $ Prelude.replicate 1000000 0x0) | ||
] | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters