summaryrefslogtreecommitdiffhomepage
path: root/ExpensiveHash.hs
diff options
context:
space:
mode:
authorJoey Hess <joeyh@joeyh.name>2016-08-30 13:23:11 -0400
committerJoey Hess <joeyh@joeyh.name>2016-08-30 13:23:39 -0400
commit2106de31f7a8e37bb2ea8b8e9650a26dbef0d893 (patch)
tree93f85b3a302dbcb234752e19f1b209a7f812cbac /ExpensiveHash.hs
parentb02bfe47d0a07b813dfd5bc3a78ad02c3673b493 (diff)
downloadkeysafe-2106de31f7a8e37bb2ea8b8e9650a26dbef0d893.tar.gz
show estimate for all rounds
Diffstat (limited to 'ExpensiveHash.hs')
-rw-r--r--ExpensiveHash.hs10
1 files changed, 8 insertions, 2 deletions
diff --git a/ExpensiveHash.hs b/ExpensiveHash.hs
index abe89ca..fed6d18 100644
--- a/ExpensiveHash.hs
+++ b/ExpensiveHash.hs
@@ -80,10 +80,16 @@ benchmarkTunables tunables = do
let normalrounds = fromIntegral $
256 * randomSaltBytes (keyEncryptionKeyTunable tunables)
putStrLn $ "Benchmarking 16/" ++ show normalrounds ++ " rounds of key encryption key hash..."
- print =<< benchmarkExpensiveHash 16
+ r <- benchmarkExpensiveHash 16
(keyEncryptionKeyHash $ keyEncryptionKeyTunable tunables)
(mapCost (`div` (normalrounds `div` 16)) $ randomSaltBytesBruteForceCost $ keyEncryptionKeyTunable tunables)
-
+ print r
+ putStrLn $ "Estimated time for " ++ show normalrounds ++ " rounds of key encryption key hash..."
+ print $ BenchmarkResult
+ { expectedBenchmark = mapCost (* 16) (expectedBenchmark r)
+ , actualBenchmark = mapCost (* 16) (actualBenchmark r)
+ }
+
putStrLn "Benchmarking 1 round of name generation hash..."
print =<< benchmarkExpensiveHash 1
(nameGenerationHash $ nameGenerationTunable tunables)