File tree Expand file tree Collapse file tree 1 file changed +14
-6
lines changed Expand file tree Collapse file tree 1 file changed +14
-6
lines changed Original file line number Diff line number Diff line change @@ -41,15 +41,23 @@ $userData = [
4141];
4242
4343$zxcvbn = new Zxcvbn();
44- $strength = $zxcvbn->passwordStrength('password', $userData);
45- echo $strength['score'];
46- // will print 0
44+ $weak = $zxcvbn->passwordStrength('password', $userData);
45+ echo $weak['score']; // will print 0
4746
48- $strength = $zxcvbn->passwordStrength('correct horse battery staple');
49- echo $strength['score'];
50- // will print 4
47+ $strong = $zxcvbn->passwordStrength('correct horse battery staple');
48+ echo $strong['score']; // will print 4
49+
50+ echo $weak['feedback']['warning']; // will print user-facing feedback on the password, set only when score <= 2
51+ // $weak['feedback']['suggestions'] may contain user-facing suggestions to improve the score
5152```
5253
54+ Scores are integers from 0 to 4:
55+ * 0 means the password is extremely guessable (within 10^3 guesses), dictionary words like 'password' or 'mother' score a 0
56+ * 1 is still very guessable (guesses < 10^6), an extra character on a dictionary word can score a 1
57+ * 2 is somewhat guessable (guesses < 10^8), provides some protection from unthrottled online attacks
58+ * 3 is safely unguessable (guesses < 10^10), offers moderate protection from offline slow-hash scenario
59+ * 4 is very unguessable (guesses >= 10^10) and provides strong protection from offline slow-hash scenario
60+
5361### Acknowledgements
5462Thanks to:
5563* @lowe for the original [ Javascript Zxcvbn] ( https://github.com/lowe/zxcvbn )
You can’t perform that action at this time.
0 commit comments