https://github.com/tcort/passwd-strength
computes password strength and checks against a list of common passwords
https://github.com/tcort/passwd-strength
entropy password password-strength
Last synced: 6 months ago
JSON representation
computes password strength and checks against a list of common passwords
- Host: GitHub
- URL: https://github.com/tcort/passwd-strength
- Owner: tcort
- License: isc
- Created: 2015-10-27T23:03:43.000Z (almost 10 years ago)
- Default Branch: master
- Last Pushed: 2023-04-16T20:09:13.000Z (over 2 years ago)
- Last Synced: 2025-03-28T02:45:59.371Z (7 months ago)
- Topics: entropy, password, password-strength
- Language: JavaScript
- Size: 162 KB
- Stars: 2
- Watchers: 4
- Forks: 7
- Open Issues: 3
-
Metadata Files:
- Readme: README.md
- Contributing: CONTRIBUTING.md
- License: LICENSE.md
Awesome Lists containing this project
README
# passwd-strength
Simple password strength calculator. It computes the number of bits of entropy of a given password
and also checks the password against a list of over 30,000 common passwords.## Installation
npm install --save passwd-strength
## API
### passwdStrength(passwd)
Parameters:
* `passwd` - the password to test.
Returns:
* The number of bits of entropy (floating point number). Higher is better. 0 is returned when a common passwords such as `abc123`, `password`, etc is encountered.
## Example
```
"use strict";var passwdStrength = require('passwd-strength');
app.post('/register', function (req, res, next) {
if (passwdStrength(req.body.passwd) < 29) {
next(new Error('Password not strong enough. Add entropy by increasing the password length and including upper case letters, lower case letters, digits, and punctuation.'));
return;
}
// ...
});```
## Tips
[RFC4086](https://tools.ietf.org/html/rfc4086) has a section on [Password Generation](https://tools.ietf.org/html/rfc4086#page-35)
that explains how to determine how much entropy you need.## License
See [LICENSE.md](https://github.com/tcort/passwd-strength/blob/master/LICENSE.md)