Skip to content

Instantly share code, notes, and snippets.

Created May 3, 2011 19:58
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save anonymous/954093 to your computer and use it in GitHub Desktop.
Save anonymous/954093 to your computer and use it in GitHub Desktop.
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