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 🙏

© 2024 – Pkg Stats / Ryan Hefner

crypto-pwd-generator

v1.3.1

Published

A strong password generator

Downloads

12

Readme

crypto-pwd-generator

NPM Version NPM Downloads NPM License Crypto Node Current npm bundle size

A simple, configurable library for generating rock-solid passwords.

Overview

crypto-pwd-generator allows you to generate password lists or single passwords of any length and composed of any group of characters. The mechanism is as simple as calling a single function even without any parameters. It can be used in Node.js CLI applications, WEB applications or VSCode extensions.

The randomization engine is based on the Crypto library, which is considered cryptographically secure and ensures a level of security suitable for industrial or military applications.

Thanks to the use of the crypto library and an effective shuffling algorithm, the passwords produced are aesthetically beautiful and expressive of a high level of entropy.

Features

The generator, by default, produces a password or a list of 10 passwords, each of them 12 characters long and containing at least one uppercase character, at least one lowercase character, at least one number and at least one special character. It is possible to pass to the generator a list of parameters with which every aspect of the password list structure can be configured.

Requirements

Node version 8 or later.

Installation

npm install crypto-pwd-generator

How to use

const pwds = require('crypto-pwd-generator');

//////
// Generate a list of passwords with default parameters
const pwdsList = pwds.generate();
pwdsList.forEach(pw => console.log('default', pw));

// ... or just a single password
const pw = pwds.password();
console.log('one default', pw);

//////
// Generate 20 passwords 32 characters long in the
// format of hexadecimal numbers
const params = {
  quantity: 20,
  pwLength: 32,
  uppercases: 'abcdef0123456789',
  lowercases: 'abcdef0123456789',
  symbols: 'abcdef0123456789',
  digits: 'abcdef0123456789',
};

const hexPwList = pwds.generate(params);
hexPwList.forEach(pw => console.log('hexadecimal', pw));

// one password with the same requirements
const custPw = pwds.password(params);
console.log('one hexadecimal', custPw);

//////
// Generate 10 passwords 8 characters long without
// uppercase characters or symbols; only numbers
// and lowercase characters.
params = {
  pwLength: 8,
  uppercases: 'abcdefghijklmnopqrstuvwxyz',
  symbols: '1234567890',
};

const noUpCasePwList = pwds.generate(params);
noUpCasePwList.forEach(pw => console.log('no uppercases', pw));

// one password with the same requirements
const noUpCasePw = pwds.password(params);
console.log('one no uppercases', noUpCasePw);

Managing settings

The generators can be invoked without any parameters (in this case the default parameters are used) or with a parameter consisting of an object containing one or more of the following values:

const pwds = require('crypto-pwd-generator');

const pwdsList = pwds.generate({
  //////
  // the length of every generated password;
  // type: number; min: 8 chars; max: 128 chars; default: 12 chars;
  pwLength: 12,
  //////
  // the length of the generated list;
  // type: number; min: 1; max: 100; default: 10;
  quantity: 10,
  //////
  // A string containing the uppercase characters used to construct the passwords;
  // type: string; minLength: 4; maxLength: 128; default: 'ABCDEFGHIJKLMNOPQRSTUVWXYZ';
  uppercases: 'ABCDEFGHIJKLMNOPQRSTUVWXYZ',
  //////
  // Minimum amount of uppercase characters contained in each password;
  // type: number; min: 1; max: 2; default: 1;
  uppercasesQty: 1,
  //////
  // A string containing the lowercase characters used to construct the passwords;
  // type: string; minLength: 4; maxLength: 128; default: 'abcdefghijklmnopqrstuvwxyz';
  lowercases: 'abcdefghijklmnopqrstuvwxyz',
  //////
  // Minimum amount of lowercase characters contained in each password;
  // type: number; min: 1; max: 2; default: 1;
  lowercasesQty: 1,
  //////
  // A string containing the numbers used to construct the passwords;
  // type: string; minLength: 4; maxLength: 128; default: '0123456789';
  digits: '0123456789',
  //////
  // Minimum amount of digits contained in each password;
  // type: number; min: 1; max: 2; default: 1;
  digitsQty: 1,
  //////
  // A string containing the symbols used to construct the passwords;
  // type: string; minLength: 4; maxLength: 128; default: '£$%&+*/-@#';
  symbols: '£$%&+*/-@#',
  //////
  // Minimum amount of special characters contained in each password;
  // type: number; min: 1; max: 2; default: 1;
  symbolsQty: 1,
});

Contributing

Contributions to this project are welcomed!

Whether you have

  • questions, concerns, or suggestions for improving this library
  • want to report a bug
  • submit a fix
  • propose new features

please don't hesitate to reach out to me on GitHub and open an issue.

Disclaimer

This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this program. If not, see https://www.gnu.org/licenses/.