npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

cracklib

v3.0.0

Published

NodeJS access to cracklib functions

Readme

node-cracklib - C++ binding to cracklib for checking password strength.

System Compatibility

node-cracklib is only compatible with linux and BSD-like systems. It has been tested on

  • Debian
  • CentOS
  • netbsd

Node Compatibility

node-cracklib is tested with the following node versions:

  • 16.x
  • 17.x
  • 18.x
  • 19.x
  • 20.x
  • 21.x
  • 22.x
  • 23.x
  • 24.x

Support for voersions 12.x, 13.x, 14,x, and 15.x is still available in version 2.x of this library.

Installing

Note that this package requires that the cracklib development libraries are installed. Installation may vary on your system but, for example on Debian:

$ apt-get install libcrack2-dev

To install via npm:

$ npm install cracklib

Or clone the repository and build from source:

$ git clone [email protected]:landlines/node-cracklib.git
$ node-gyp configure -- -DMODULE_NAME=cracklib -DBUILD_TARGET=/path/to/app
$ node-gyp build

Usage

node-cracklib exposes both fascistCheck and fascistCheckUser from the cracklib library using the following methods:

  • fascistCheck(password[, dictionaryPath])
  • fascistCheckAsync(password[, dictionaryPath], callback)
  • fascistCheckUser(password, user, gecos[, dictionaryPath])
  • fascistCheckUserAsync(password, user, gecos[, dictionaryPath], callback)

fascistCheck() uses the currently logged in user when checking passwords. fascistCheckUser() allows submission of an arbitray user and user gecos field. The submitted user need not be a valid user on your system. A phony username and gecos can be used as can null or an empty string value. Both user and gecos are required parameters when using fascistCheckUser() or the async variant.

Both methods and their async variants support custom dictionaries using the optional dictionaryPath parameter. The default dictionary is used otherwise.

Response

The response to all methods is a simple dictionary response with a single member, message. message is a String if the password is considered weak and null if the password is considered good. The messages are passed directly from the cracklib C library and are not changed in any way by this module.

{
  "message": String | null - Return value from the password check
}

Examples

let cracklib = require('cracklib');

// fascistCheck()
let reponse = cracklib.fascistCheck('somePassword');

// fascistCheck() with a custom dictionary
let response = cracklib.fascistCheck('somePassword', '/path/to/dictionary');

// fascistCheckAsync()
cracklib.fascistCheckAsync('somePassword', (r) => {
    console.log(r.message);
});

// fascistCheckAsync() with a custom dictionary
cracklib.fascistCheckAsync('somePassword', '/path/to/dictionary', (r) => {
    console.log(r.message);
});

// fascistCheckUser()
let response = cracklib.fascistCheckUser('somePassword', 'alice', null);

// fascistCheckUser() with a custom dictionary
let response = cracklib.fascistCheckUser('somePassword', 'alice', null,
    '/path/to/dictionary');

// fascistCheckUserAsync()
cracklib.fascistCheckUserAsync('somePassword', 'alice', null, (r) => {
    console.log(r.message);
});

// fascistCheckUserAsync() with a custom dictionary
cracklib.fascistCheckUserAsync('somePassword', 'alice', null, 
    '/path/to/dictionary', (r) => {
        console.log(r.message);
    });

Support

Please file bugs, issues, etc. at https://github.com/landlines/node-cracklib/issues. PRs for bug fixes are welcome.

Development

If you want to hack on this code you'll need to make sure that the following are installed on your system:

  • NodeJs development libraries
  • Cracklib development libraries
  • node-gyp

Clone and Build

$ git clone [email protected]:landlines/node-cracklib.git
$ node-gyp configure -- -DMODULE_NAME=cracklib -DBUILD_TARGET=/path/to/app
$ node-gyp build

References