summaryrefslogtreecommitdiffhomepage
path: root/Types
diff options
context:
space:
mode:
authorJoey Hess <joeyh@joeyh.name>2016-08-16 12:57:19 -0400
committerJoey Hess <joeyh@joeyh.name>2016-08-16 13:04:07 -0400
commit3b4a775d536b2b2956269a59f886487efe29ed51 (patch)
treebbd8fd580afad11f822b2929061b034abf376c50 /Types
parentd7696832e183cc3e98d094b35ee4392d0c8d3df5 (diff)
downloadkeysafe-3b4a775d536b2b2956269a59f886487efe29ed51.tar.gz
switch to random salt byte to make decryption expensive
Diffstat (limited to 'Types')
-rw-r--r--Types/Cost.hs8
1 files changed, 3 insertions, 5 deletions
diff --git a/Types/Cost.hs b/Types/Cost.hs
index a6a1160..290fa25 100644
--- a/Types/Cost.hs
+++ b/Types/Cost.hs
@@ -12,8 +12,6 @@ import Utility.HumanTime
-- | An estimated cost to perform an operation.
data Cost op
= CPUCost Seconds -- ^ using 1 CPU core
- | GPUCost Seconds
- | CombinedCost (Cost op) (Cost op)
deriving (Show)
unknownCost :: Cost op
@@ -32,9 +30,9 @@ instance Monoid (Cost t) where
mempty = CPUCost (Seconds 0)
CPUCost (Seconds a) `mappend` CPUCost (Seconds b) =
CPUCost (Seconds (a+b))
- GPUCost (Seconds a) `mappend` GPUCost (Seconds b) =
- GPUCost (Seconds (a+b))
- a `mappend` b = CombinedCost a b
+
+mapCost :: (Integer -> Integer) -> Cost op -> Cost op
+mapCost f (CPUCost (Seconds n)) = CPUCost (Seconds (f n))
-- | Operations whose cost can be measured.
data DecryptionOp