summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--ExpensiveHash.hs11
1 files changed, 9 insertions, 2 deletions
diff --git a/ExpensiveHash.hs b/ExpensiveHash.hs
index 4031ef3..abe89ca 100644
--- a/ExpensiveHash.hs
+++ b/ExpensiveHash.hs
@@ -73,10 +73,17 @@ benchmarkTunables :: Tunables -> IO ()
benchmarkTunables tunables = do
putStrLn "/proc/cpuinfo:"
putStrLn =<< readFile "/proc/cpuinfo"
- putStrLn "Benchmarking 16 rounds of key generation hash..."
+
+ -- Rather than run all 256 rounds of this hash, which would
+ -- probably take on the order of 1 hour, run only 16, and scale
+ -- the expected cost accordingly.
+ let normalrounds = fromIntegral $
+ 256 * randomSaltBytes (keyEncryptionKeyTunable tunables)
+ putStrLn $ "Benchmarking 16/" ++ show normalrounds ++ " rounds of key encryption key hash..."
print =<< benchmarkExpensiveHash 16
(keyEncryptionKeyHash $ keyEncryptionKeyTunable tunables)
- (mapCost (`div` 16) $ randomSaltBytesBruteForceCost $ keyEncryptionKeyTunable tunables)
+ (mapCost (`div` (normalrounds `div` 16)) $ randomSaltBytesBruteForceCost $ keyEncryptionKeyTunable tunables)
+
putStrLn "Benchmarking 1 round of name generation hash..."
print =<< benchmarkExpensiveHash 1
(nameGenerationHash $ nameGenerationTunable tunables)