From e2d8d422a6f03ad94221f6540846e61adf731b0c Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Sun, 28 Aug 2016 21:09:28 -0400 Subject: refactor --- Tunables.hs | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) (limited to 'Tunables.hs') 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 -- cgit v1.2.3