diff options
author | Perlbotics <perlbotix@cpan.org> | 2017-11-15 21:34:07 +0100 |
---|---|---|
committer | Perlbotics <perlbotix@cpan.org> | 2017-11-15 21:34:07 +0100 |
commit | 1316210f7d795de8ff7d4c5651501a33248b6e20 (patch) | |
tree | 429733e28a6b9e41c01aaa8d66b9fd38776e6506 | |
parent | 729be61ffc589a01850d93ab9b9679b097b559b3 (diff) | |
download | zxcvbn-c-1316210f7d795de8ff7d4c5651501a33248b6e20.tar.gz |
Exhaustive spacial tests across all registered keyboard layouts.
The previous test stopped when a (any) match for a given substring was
found. While this is slightly faster than an exhaustive search across
all registered keyboard layouts, it could result in a too optimistic
entropy estimation.
Example: The string jkl;'# yield the following entropies depending
whether the UK-keyboard layout had a chance to be tested or not:
Layout Code base Entropy
----------------------------------------------------------------------
US previous bits=17.080 log10=5.142 Multi-word extra bits=1.0
UK this bits=11.116 log10=3.346 Multi-word extra bits=0.0
----------------------------------------------------------------------
The time to perform these checks were identical (i.e. 0.07ms, here).
A new testcase for UK-layout was added.
All legacy tests pass. New test passes. valgrind-check: passed
-rw-r--r-- | testcases.txt | 4 | ||||
-rw-r--r-- | zxcvbn.c | 3 |
2 files changed, 5 insertions, 2 deletions
diff --git a/testcases.txt b/testcases.txt index 8eaeac3..cddf519 100644 --- a/testcases.txt +++ b/testcases.txt @@ -59,4 +59,8 @@ pass.word.pass.word.pass.word. 60.41 passpasswordword 17.28 quvpzquvpz 24.50 +#-- with UK KBD (US-KBD=17.08) +jkl;'# 11.12 + magicfavoriteunclepromisedpublicbotherislandjimseriouslycellleadknowingbrokenadvicesomehowpaidblairlosingpushhelpedkillingusuallyearlierbosslaurabeginninglikedinnocentdocruleselizabethsabrinasummerexcoplearnedthirtyrisklettingphillipspeakingofficerridiculoussupportafternoonericwithsobutallwellareheohaboutrightyou're 545.9 + @@ -1148,9 +1148,9 @@ static void SpatialMatch(ZxcMatch_t **Result, const uint8_t *Passwd, int Start, for(CurLen = MaxLen; CurLen >= MIN_SPATIAL_LEN;CurLen = Len - 1) { Len = 0; - memset(&Extra, 0, sizeof Extra); for(k = Keyboards, Indx = 0; Indx < (sizeof Keyboards / sizeof Keyboards[0]); ++Indx, ++k) { + memset(&Extra, 0, sizeof Extra); Len = DoSptlMatch(Passwd, CurLen, k, &Extra); if (Len > 0) { @@ -1201,7 +1201,6 @@ static void SpatialMatch(ZxcMatch_t **Result, const uint8_t *Passwd, int Start, p->Length = Len; AddMatchRepeats(Result, p, Passwd, MaxLen); AddResult(Result, p, MaxLen); - break; } } } |