Skip to content

Commit

Permalink
Fix calc_bruteforce_cardinality
Browse files Browse the repository at this point in the history
The function was overestimating the cardinality
for upper-case characters and digits by mistakenly
identifying them as symbols. Thus a simple repeat
sequence like "AAAAAA" would have cardinality
26+33=59 rather than 26.
  • Loading branch information
tekul committed Jun 10, 2012
1 parent a12f1fd commit c753c80
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions scoring.coffee
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -234,9 +234,9 @@ calc_bruteforce_cardinality = (password) ->
ord = chr.charCodeAt(0) ord = chr.charCodeAt(0)
if 0x30 <= ord <= 0x39 if 0x30 <= ord <= 0x39
digits = true digits = true
if 0x41 <= ord <= 0x5a else if 0x41 <= ord <= 0x5a
upper = true upper = true
if 0x61 <= ord <= 0x7a else if 0x61 <= ord <= 0x7a
lower = true lower = true
else else
symbols = true symbols = true
Expand Down

0 comments on commit c753c80

Please sign in to comment.