hkdf

Pure Haskell HMAC-based KDF (docs.ppad.tech/hkdf).
git clone git://git.ppad.tech/hkdf.git
Log | Files | Refs | README | LICENSE

Main.hs (599B)


      1 {-# LANGUAGE OverloadedStrings #-}
      2 
      3 module Main where
      4 
      5 import Criterion.Main
      6 import qualified Crypto.KDF.HMAC as KDF
      7 import qualified Crypto.Hash.SHA256 as SHA256
      8 import qualified Crypto.Hash.SHA512 as SHA512
      9 
     10 main :: IO ()
     11 main = defaultMain [
     12     suite
     13   ]
     14 
     15 suite :: Benchmark
     16 suite =
     17   bgroup "ppad-hkdf" [
     18     bgroup "HKDF-SHA256" [
     19       bench "derive (outlen 32)" $
     20         nf (KDF.derive SHA256.hmac "muh salt" "muh info" 32) "muh secret"
     21     ]
     22   , bgroup "HKDF-SHA512" [
     23       bench "derive (outlen 32)" $
     24         nf (KDF.derive SHA512.hmac "muh salt" "muh info" 32) "muh secret"
     25     ]
     26   ]
     27