summaryrefslogtreecommitdiffhomepage
path: root/Cost.hs
diff options
context:
space:
mode:
authorJoey Hess <joeyh@joeyh.name>2016-08-07 13:58:41 -0400
committerJoey Hess <joeyh@joeyh.name>2016-08-07 13:58:41 -0400
commit460edfad8ed45412050822dfdf84f2d54015fb04 (patch)
treec356183a9d1952386355d9e861819dae9ad62989 /Cost.hs
parent6205bbac7abc919371a5e7af9e4ba1a8d70de85e (diff)
downloadkeysafe-460edfad8ed45412050822dfdf84f2d54015fb04.tar.gz
refacor
Diffstat (limited to 'Cost.hs')
-rw-r--r--Cost.hs7
1 files changed, 1 insertions, 6 deletions
diff --git a/Cost.hs b/Cost.hs
index 3c7c21d..c31c4f8 100644
--- a/Cost.hs
+++ b/Cost.hs
@@ -7,8 +7,6 @@ import Entropy
import Utility.HumanTime
import Data.Monoid
-import qualified Data.ByteString.UTF8 as B
-
-- | An estimated cost to perform an operation.
data Cost op
= CPUCost Seconds
@@ -79,10 +77,7 @@ data UnknownPassword
-- account, so this is an overestimation of how hard a password
-- is to crack.
passwordEntropy :: Password -> Entropy UnknownPassword
-passwordEntropy (Password p) = Entropy $ floor $
- entropy s * fromIntegral (length s)
- where
- s = B.toString p
+passwordEntropy (Password p) = Entropy $ floor $ totalEntropy p
-- | CostCalc for a brute force linear search through an entropy space
-- in which each step entails paying a cost.