File tree Expand file tree Collapse file tree 1 file changed +4
-2
lines changed Expand file tree Collapse file tree 1 file changed +4
-2
lines changed Original file line number Diff line number Diff line change @@ -8,14 +8,16 @@ import Data.List (foldl')
8
8
9
9
import "criterion" Criterion.Main
10
10
import qualified "memory" Data.ByteArray as B
11
+ import qualified "memory" Data.ByteArray.Encoding as E
11
12
import qualified "base16-bytestring" Data.ByteString.Base16 as B16
12
13
import qualified "bytestring" Data.ByteString as BS
14
+ import qualified "bytestring" Data.ByteString.Char8 (pack )
13
15
import qualified "blake2" Crypto.Hash.BLAKE2.BLAKE2b as Original
14
16
import qualified "blake2-patched" Crypto.Hash.BLAKE2.BLAKE2b as Patched
15
17
import qualified "cryptonite" Crypto.Hash as Cryptonite
16
18
17
19
cryptoniteHash :: BS. ByteString -> BS. ByteString
18
- cryptoniteHash = B16. encode . B. convert . Cryptonite. hashWith Cryptonite. Blake2b_512
20
+ cryptoniteHash = ( B. convert :: BS. ByteString -> BS. ByteString ) . E. convertToBase E. Base16 . Cryptonite. hashWith Cryptonite. Blake2b_512
19
21
{-# INLINE cryptoniteHash #-}
20
22
21
23
originalHash :: BS. ByteString -> BS. ByteString
@@ -37,7 +39,7 @@ main = defaultMain
37
39
38
40
hashes :: IO [BS. ByteString ]
39
41
hashes = let
40
- ns = map (cryptoniteHash . pack . show ) [1 .. 100000 ]
42
+ ns = map (patchedHash . pack . show ) [1 .. 100000 ]
41
43
in length ns `seq` pure ns
42
44
43
45
bencher :: (BS. ByteString -> BS. ByteString ) -> IO Bool
You can’t perform that action at this time.
0 commit comments