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

passfather

v3.0.6

Published

Passfather is very fast and powerful utility with zero dependencies to generate strong password

Downloads

9,186

Readme

passfather

version npm downloads license

passfather is a very fast and powerful utility with zero dependencies, designed to generate strong passwords or random strings.

passfather is free and will always remain free A simple and quick way to support the project is to buy me a coffee. It will take no more than 5 minutes and will allow the project to keep going

Table of contents

Features

  • Supports both browsers and Node.js.;
  • Offers multiple random number algorithms such as Alea, KISS07, Kybos, LFib, LFIB4, MRG32k3a, Xorshift03. By default, it uses getRandomValues for browsers and getRandomBytes for Node.js;
  • Supports seeding with entropy;
  • Optionally utilizes any Unicode characters;
  • Allows for any password length.

Installation

NPM

npm install --save passfather

Yarn

yarn add passfather

ESM
<script type="module">
    import passfather from 'https://unpkg.com/passfather@latest/dist/passfather.min.mjs'
    console.log( passfather() ); // Output "vFR_@1hDMhAr"
</script>
UMD
<script src="https://unpkg.com/passfather@latest/dist/passfather.min.js"></script>
<script>
    console.log( passfather() ); // Output "r_@1hDvFRMhA"
</script>

Example

It's very easy! Just import passfather and run the function.

import passfather from 'passfather';
const password = passfather();
console.log(password); // Output "9g'Jta75Gl3w"

By default, passfather does not require any options. However, it is possible to pass an options object to customize the password.

import passfather from 'passfather';
const password = passfather({
  numbers: true,
  uppercase: true,
  lowercase: true,
  symbols: false, // Disable symbols
  length: 16,
});
console.log(password); // Output "40rAe2hqiM0UzTmN"

NOTE: an options object is passed, it merges with the default options object.

Options

|Name|Type|Default|Description |---|---|---|--- |numbers|boolean|true|Enable/disable numbers |uppercase|boolean|true|Enable/disable uppercase |lowercase|boolean|true|Enable/disable lowercase |symbols|boolean|true|Enable/disable symbols |length|integer|12|Final string length |prng|string|default| The algorithm for generating random strings uses random numbers generated by a pseudorandom number generator (PRNG). Options include default, Alea, KISS07, Kybos, LFib, LFIB4, MRG32k3a, and Xorshift03. By default, it uses getRandomValues for browsers and getRandomBytes for Node.js; |seed|array|seed.js|Seed for the PRNG. See random seed for details. NOTE: The default value may not have sufficient entropy. It is recommended to use your own values for better security. |ranges|array|null|UTF-8 character ranges that will be used to generate the random string. See below for details.

Options: ranges (custom characters)

Passfather can create passwords containing custom characters through the ranges option.

For example:

import passfather from 'passfather';
const password = passfather({
  numbers: false,
  uppercase: false,
  lowercase: false,
  symbols: false,
  length: 16,
  ranges: [ 
    [[9800, 9807], [9818, 9823]], // Group of character ranges including zodiac signs and chess figures
    [[9698, 9701], [0x2586, 0x258B]], // Geometric figures
  ],
});
console.log(password); // Output "▋▆♟◥◢♎◥♚♞♚▆♚◥▆▉♝"

The ranges option is an array of UTF-8 character ranges

Passfather supports a range from 0 to 65535 in the decimal system, and from 0x0000 to 0xFFFF in the hexadecimal system. You can find all of them on the unicode table

The example above includes UTF-8 characters with codes ranging from 9800 to 9807 and from 9818 to 9823, which represent zodiac signs and chess figures. It also includes characters with codes from 9698 to 9701 and from 0x2586 to 0x258B, representing geometric figures.

This implies that the password will necessarily contain one or more chess figures or zodiac signs and one or more geometric figures. However, it does not mean that the password will contain both zodiac signs and chess figures, as they are part of the same range. If you want to create a password that includes both zodiac signs and chess figures, you should move the chess figures to a new range.

For example:

import passfather from 'passfather';
const password = passfather({
  numbers: false,
  uppercase: false,
  lowercase: false,
  symbols: false,
  length: 16,
  ranges: [ 
    [[9800, 9807]], // Group of character ranges including zodiac signs
    [[9818, 9823]], // Chess figures.
    [[9698, 9701], [0x2586, 0x258B]], // Geometric figures
  ],
});
console.log(password); // Output "♏◣♛◥♚♟♚♝♌▆♌♚♞▉♞♞"

By creating a new range, you ensure that at least one character from that range will be part of the password.

Ranges can be used in conjunction with the number, uppercase, lowercase, or symbols options.

For example:

import passfather from 'passfather';
const password = passfather({
  // Number, uppercase, lowercase, and symbols are enabled by default, 
  // so there is no need to pass them separately
  length: 16,
  ranges: [ 
    [[9800, 9807]],
    [[9818, 9823]],
    [[9698, 9701], [0x2586, 0x258B]],
  ],
});
console.log(password); // Output "♚!N◢♊q6DO1,3▉♌k5♞"

Contributing

See contributing guideline.

License

MIT LICENSE