Created
May 3, 2011 19:58
-
-
Save anonymous/954093 to your computer and use it in GitHub Desktop.
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
import Benchmark.Crypto | |
import Criterion.Main | |
import qualified Data.ByteString as B | |
import qualified Data.ByteString.Lazy as BL | |
import qualified Data.Serialize as DS | |
import qualified Crypto.Classes as CL | |
import qualified Crypto.Modes as CM | |
data NOP128 = NOP128 { getNOPKey :: B.ByteString } | |
deriving (Read, Show) | |
instance DS.Serialize NOP128 where | |
put = DS.put . show | |
get = DS.get | |
instance CL.BlockCipher NOP128 where | |
keyLength = 128 | |
blockSize = 128 | |
buildKey = Just . NOP128 | |
encryptBlock k = id | |
decryptBlock k = id | |
main = do | |
let (Just k128) = CL.buildKey (B.pack [0..15]) :: Maybe NOP128 | |
defaultMain [ benchmarkStreamCipher k128 "NOP-128" ] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment