From d7696832e183cc3e98d094b35ee4392d0c8d3df5 Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Tue, 16 Aug 2016 01:10:33 -0400 Subject: use zxcvbn-c for fairly good password entropy estimation This should be good enough to let the keysafe UI comment on how good a password the user chooses. --- Types/Cost.hs | 3 +++ 1 file changed, 3 insertions(+) (limited to 'Types') diff --git a/Types/Cost.hs b/Types/Cost.hs index de091b8..a6a1160 100644 --- a/Types/Cost.hs +++ b/Types/Cost.hs @@ -51,6 +51,9 @@ unknownCostCalc = \_e -> error "No cost calculation available" newtype Entropy t = Entropy Int deriving (Num, Show) +class CalcEntropy d t where + calcEntropy :: d -> Entropy t + -- | Entropy can never go negative when subtracting bits from it. reduceEntropy :: Entropy t -> Int -> Entropy t reduceEntropy (Entropy a) b = Entropy (max 0 (a - b)) -- cgit v1.2.3