summaryrefslogtreecommitdiffhomepage
path: root/Tunables.hs
diff options
context:
space:
mode:
authorJoey Hess <joeyh@joeyh.name>2016-08-28 21:09:28 -0400
committerJoey Hess <joeyh@joeyh.name>2016-08-28 21:09:28 -0400
commite2d8d422a6f03ad94221f6540846e61adf731b0c (patch)
tree97b8280ba30625c71b5d93a2204f26893cb727f2 /Tunables.hs
parent945fb3387b56be0da576d06155f35372b35095bc (diff)
downloadkeysafe-e2d8d422a6f03ad94221f6540846e61adf731b0c.tar.gz
refactor
Diffstat (limited to 'Tunables.hs')
-rw-r--r--Tunables.hs10
1 files changed, 3 insertions, 7 deletions
diff --git a/Tunables.hs b/Tunables.hs
index 3fa700a..07b4c61 100644
--- a/Tunables.hs
+++ b/Tunables.hs
@@ -7,10 +7,8 @@
module Tunables where
-import Types
import Cost
import qualified Crypto.Argon2 as Argon2
-import qualified Data.ByteString as B
-- | To determine the tunables used for a key name the expensive hash of the
-- name is calculated, using a particular configuration, and if the
@@ -134,9 +132,7 @@ testModeTunables = Tunables
where
weakargon2 c = UseArgon2 c Argon2.defaultHashOptions
-validObjectsize :: StorableObject -> Bool
-validObjectsize o = any (sz ==) knownsizes
+knownObjectSizes :: [Int]
+knownObjectSizes = map (calc . snd) knownTunings
where
- sz = B.length (fromStorableObject o)
- knownsizes = map (\t -> objectSize t * shareOverhead t)
- (map snd knownTunings)
+ calc t = objectSize t * shareOverhead t