A package that implements my own algorithm to check the security of a password. 🔒 🎀
Roughly a year ago, I implemented my own algorithm to check the strength of a password in Dart. Vulcheck is my port of this package to Node.js. Vulcheck is a combination of the words Vulnerability and Checker. You can find the original algorithm here. Enjoy! ❤️🔥
The algorithm measures the distance between neighbouring characters. If the two characters being compared are of a different type, then the score is increased. If not, it is diminished. If two characters are compared and the distance is large, then the score is increased. At the end everything is totalled up.
To use Vulcheck in a Node.js project, run this command in your project's root directory:
$ npm install --save-dev vulcheck
Be sure to also add the "type":"module"
flag to your project's manifest, package.json
.
Add a file called vulcheck.d.ts
to your project and put the following code inside it:
declare module 'vulcheck';
Vulcheck offers the following functions:
getCharPositon(character)
: Returns the position of a character in the alphabet.getCharSpace(characterOne, characterTwo)
: Returns the distance between two alphabetic characters.getNumberSpace(numberOne, numberTwo)
: Returns the distance between two numbers.stringType(character)
: Returns the type of string.int
: Character is an integer.normChar
: Character is an alphabetic character.specialChar
: Character is a special symbol.
isInt(expr)
: Returns a boolean telling you whetherexpr
is an integer or not.passwordStrength(password)
: Returns a score that says how secure your password is.isSecure(password)
: Returns a boolean telling you if your password is secure or not. If the score is larger than eight, then it will returntrue
.generatePassword(length)
: Returns a password as a string of the length supplied.testAll()
: Tests all of the above.
Here's a small example:
- 1.) Initialize a new Node.js project with the following command in a directory of your choosing:
$ npm init -y
- 2.) Install Vulcheck:
$ npm install --save-dev vulcheck
- 3.) Be sure to add this line to your project's
package.json
:
"type":"module",
- 4.) Create your
index.js
and put the following code inside it:
// index.js
import * as vulcheck from 'vulcheck';
function main(){
var pwd = '1969HoglinSteak';
console.log(vulcheck.isSecure(pwd).toString());
}
main();
- 5.) Run the project:
$ node .
- 6.) This should print
false
to the console. 😉 - 7.) Optional: If you're not sure how to use this project, check out the example project.
- Initial release.
- Upload to GitHub.
- Upload to NPM.
- Fixing confusion between CJS and ESM.
- Added an example.
- More extensive documentation.
- Fixed some typos.
- Added a function to generate a password of user-supplied length.
- Fixed some ciritical issues.
- Updated documentation.
- Minor fixes.
- Speed improvements.
- Updated documentation.
- Updated, published, and uploaded under my new name.
- Fixed some administrative issues.
- Fixed some formatting.
- Updated
export
statement. - Updated documentation for Typescript.
- Vulcheck 🔒 🎀 by Alexander Abraham 🖤 a.k.a. "Angel Dollface" 🎎 🎀
- Licensed under the MIT license.