What is @zxcvbn-ts/language-common?
@zxcvbn-ts/language-common is a TypeScript library that provides common language data for the zxcvbn-ts password strength estimator. It includes dictionaries and scoring functions to help evaluate password strength based on common patterns, words, and sequences.
What are @zxcvbn-ts/language-common's main functionalities?
Common Words Dictionary
This feature provides a dictionary of common words that are used to evaluate the strength of a password. The dictionary helps in identifying weak passwords that contain easily guessable words.
const commonWords = require('@zxcvbn-ts/language-common').dictionary.commonWords;
console.log(commonWords);
L33t Speak Dictionary
This feature includes a dictionary for l33t speak (leet speak) transformations. It helps in identifying passwords that use common character substitutions, such as '3' for 'E' or '1' for 'I'.
const l33tTable = require('@zxcvbn-ts/language-common').dictionary.l33tTable;
console.log(l33tTable);
Scoring Functions
This feature provides scoring functions to evaluate the strength of a password based on the most guessable match sequence. It helps in determining how easily a password can be guessed.
const scoring = require('@zxcvbn-ts/language-common').scoring;
const score = scoring.mostGuessableMatchSequence('password123', []);
console.log(score);
Other packages similar to @zxcvbn-ts/language-common
zxcvbn
zxcvbn is a password strength estimator inspired by password crackers. It is a comprehensive library that evaluates password strength based on common patterns, words, and sequences. Compared to @zxcvbn-ts/language-common, zxcvbn is a more complete solution that includes both the language data and the estimation logic.
owasp-password-strength-test
owasp-password-strength-test is a library that provides password strength testing based on the OWASP guidelines. It includes checks for common patterns, dictionary words, and character sequences. While it offers similar functionality to @zxcvbn-ts/language-common, it is more focused on adhering to OWASP standards.
password-validator
password-validator is a simple library for validating passwords against a set of rules. It allows you to define custom rules for password strength, such as minimum length, required character types, and forbidden words. Unlike @zxcvbn-ts/language-common, it does not provide dictionaries or scoring functions but offers flexibility in defining password policies.
@zxcvbn-ts/language-common
The common dictionary and language package for zxcvbn-ts
Install
npm:
npm install @zxcvbn-ts/language-common --save
yarn:
yarn add @zxcvbn-ts/language-common
Setup
import { zxcvbn, zxcvbnOptions } from '@zxcvbn-ts/core'
import * as zxcvbnCommonPackage from '@zxcvbn-ts/language-common'
const password = 'somePassword'
const options = {
...zxcvbnCommonPackage,
}
zxcvbnOptions.setOptions(options)
zxcvbn(password)