summaryrefslogtreecommitdiffhomepage
path: root/Cost.hs
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 /Cost.hs
parentd7696832e183cc3e98d094b35ee4392d0c8d3df5 (diff)
downloadkeysafe-3b4a775d536b2b2956269a59f886487efe29ed51.tar.gz
switch to random salt byte to make decryption expensive
Diffstat (limited to 'Cost.hs')
-rw-r--r--Cost.hs9
1 files changed, 0 insertions, 9 deletions
diff --git a/Cost.hs b/Cost.hs
index c7ab9dd..31f00a3 100644
--- a/Cost.hs
+++ b/Cost.hs
@@ -15,24 +15,15 @@ import Types.Cost
-- | Cost in seconds, with the type of hardware needed.
totalCost :: Cost op -> (Seconds, [UsingHardware])
totalCost (CPUCost s) = (s, [UsingCPU])
-totalCost (GPUCost s) = (s, [UsingGPU])
-totalCost (CombinedCost a b) =
- let (s1, h1) = totalCost a
- (s2, h2) = totalCost b
- in (s1+s2, h1++h2)
raiseCostPower :: Cost c -> Entropy e -> Cost c
raiseCostPower c (Entropy e) = adjustCost c (* 2^e)
adjustCost :: Cost c -> (Seconds -> Seconds) -> Cost c
adjustCost (CPUCost s) f = CPUCost (f s)
-adjustCost (GPUCost s) f = GPUCost (f s)
-adjustCost (CombinedCost a b) f = CombinedCost (adjustCost a f) (adjustCost b f)
castCost :: Cost a -> Cost b
castCost (CPUCost s) = CPUCost s
-castCost (GPUCost s) = GPUCost s
-castCost (CombinedCost a b) = CombinedCost (castCost a) (castCost b)
-- | CostCalc for a brute force linear search through an entropy space
-- in which each step entails paying a cost.