Skip to content

Commit 7153931

Browse files
authored
Update README.md
Closes #40
1 parent c0f72f4 commit 7153931

File tree

1 file changed

+14
-6
lines changed

1 file changed

+14
-6
lines changed

README.md

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff 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
5462
Thanks to:
5563
* @lowe for the original [Javascript Zxcvbn](https://github.com/lowe/zxcvbn)

0 commit comments

Comments
 (0)