summaryrefslogtreecommitdiffhomepage
path: root/ExpensiveHash.hs
diff options
context:
space:
mode:
authorJoey Hess <joeyh@joeyh.name>2016-08-07 18:49:15 -0400
committerJoey Hess <joeyh@joeyh.name>2016-08-07 18:51:09 -0400
commit07bd29a80ed36c63296214af34689d0cce14751f (patch)
treec22aa59dde551c5fb7f54f26e406c70dc441171f /ExpensiveHash.hs
parent6f2d6120533070ce48bbc1e12465d1f7d603aec8 (diff)
downloadkeysafe-07bd29a80ed36c63296214af34689d0cce14751f.tar.gz
reorg, and working on serialization
Diffstat (limited to 'ExpensiveHash.hs')
-rw-r--r--ExpensiveHash.hs7
1 files changed, 4 insertions, 3 deletions
diff --git a/ExpensiveHash.hs b/ExpensiveHash.hs
index ca357bc..c27f703 100644
--- a/ExpensiveHash.hs
+++ b/ExpensiveHash.hs
@@ -3,8 +3,8 @@
module ExpensiveHash where
import Types
+import Serialization
import Cost
-import Tunables
import qualified Data.ByteString as B
import Raaz.Core.Encode
import qualified Crypto.Argon2 as Argon2
@@ -23,8 +23,9 @@ data Salt t = Salt t
expensiveHash :: Encodable t => Tunables -> Salt t -> Password -> ExpensiveHash
expensiveHash tunables (Salt s) (Password password) =
- ExpensiveHash (argonCost tunables) $
- Argon2.hash (argonOptions tunables) password (toByteString s)
+ case expensiveHashTunable tunables of
+ UseArgon2 opts cost -> ExpensiveHash cost $
+ Argon2.hash opts password (toByteString s)
benchmarkExpensiveHash :: Tunables -> IO (Benchmark (Cost CreationOp))
benchmarkExpensiveHash tunables = do