diff options
author | Joey Hess <joeyh@joeyh.name> | 2016-08-28 21:09:28 -0400 |
---|---|---|
committer | Joey Hess <joeyh@joeyh.name> | 2016-08-28 21:09:28 -0400 |
commit | e2d8d422a6f03ad94221f6540846e61adf731b0c (patch) | |
tree | 97b8280ba30625c71b5d93a2204f26893cb727f2 /Tunables.hs | |
parent | 945fb3387b56be0da576d06155f35372b35095bc (diff) | |
download | keysafe-e2d8d422a6f03ad94221f6540846e61adf731b0c.tar.gz |
refactor
Diffstat (limited to 'Tunables.hs')
-rw-r--r-- | Tunables.hs | 10 |
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 |