diff options
author | Joey Hess <joeyh@joeyh.name> | 2016-08-16 01:10:33 -0400 |
---|---|---|
committer | Joey Hess <joeyh@joeyh.name> | 2016-08-16 01:14:29 -0400 |
commit | d7696832e183cc3e98d094b35ee4392d0c8d3df5 (patch) | |
tree | 1d01e6796d359b04f2b09aa509270884a836f737 /Types | |
parent | 6c4d1501b1067e47cbf8579eb206a30d9c3a7a1c (diff) | |
download | keysafe-d7696832e183cc3e98d094b35ee4392d0c8d3df5.tar.gz |
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.
Diffstat (limited to 'Types')
-rw-r--r-- | Types/Cost.hs | 3 |
1 files changed, 3 insertions, 0 deletions
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)) |