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

node-jen

v1.1.0

Published

Jen is a portable and safe Javascript password/number generator

Downloads

106

Readme

Jen is a portable and safe Javascript password/number generator

Build Status

NPM

Jen allows to generate passwords, random bytes and random numbers securely using cryptographic approach.

Jen supports 4 engines to generate random bytes :

  • NodeJS Crypto API
  • W3C Crypto API http://www.w3.org/TR/WebCryptoAPI/
  • Microsoft Crypto API https://msdn.microsoft.com/en-us/library/windows/desktop/aa380256(v=vs.85).aspx
  • Failsafe

Failsafe uses Math.random() which is not safe because the random number generator doesn't use a cryptographic approach.

## Hardened passwords Jen has a hardened passwords generator activated by default which adds specials chars into the password. For those who want to use Jen for others things they must set to false the hardened argument at the constructor.

## Install

On NodeJS

npm install node-jen

### On browser

<script type="text/javascript" src="path/to/jen.js"></script>

### With browserify & Webpack

Just include / require this repo or jen.js direcly into your code.

Library

Jen(hardened, banFailsafe)

var hdl = new Jen(true, true);
  • hardened: Use hardened version includes specials chars into password generator: (default true)
  • banFailsafe: Generate an alert when using Failsafe cryptography (default true)

## Jen.password(min, max, regex) ## Jen.password(min, max) ## Jen.password(min) This function returns a random String.

  • min: Minimum String length (must be upper to 4)
  • max: Maximum String length
  • regex: Regular expression to filter selected chars
console.log("10 Passwords from 10 to 30 w/o hardening");
for(var a=0; a<10; a++)
	console.log(hdl.password(10, 30));

console.log("10 Passwords fixed 5 w/o hardening");
for(var a=0; a<10; a++)
	console.log(hdl.password(5));

console.log("10 Passwords from 10 to 30 w/ hardening");
hdl.hardening(true);
for(var a=0; a<10; a++)
	console.log(hdl.password(10, 30));

console.log("10 Passwords fixed 10 w/ hardening");
for(var a=0; a<10; a++)
	console.log(hdl.password(10, 10));

console.log("10 Passwords fixed 10 w/o hardening with regex [A-F0-9]");
hdl.hardening(false);
for(var a=0; a<10; a++)
	console.log(hdl.password(10, 10, /[A-F0-9]/));

## Jen.random(size) Generate random numbers (integers) into a String.

  • size: Size of bytes read from randomBytes
console.log("10 Random string (based on 4 bytes)");
for(var a=0; a<10; a++)
	console.log(hdl.random(4));

## Jen.randomBytes(size) Generate random bytes into an Uint8Array.

  • size: Size of bytes read from randomBytes
console.log("10 Random 4 bytes");
for(var a=0; a<10; a++)
	console.log(hdl.randomBytes(4));

## Jen.randomBetween(max, min) Generate random number between the given min and max arguments

  • max: Maximum value
  • min: Minimum value
console.log("10 Random number between 10 and 3000");
for(var a=0; a<10; a++)
	console.log(hdl.randomBetween(3000, 10));

Jen.hardening(bool)

Set on/off hardening string generator

  • bool: boolean to activate hardened password generator (default true)

Jen.engine()

Returns the current engine in a String

console.log("Engine: "+hdl.engine());

Jen.stats()

Get password generation statistics

console.log("Last pass stats: "+hdl.stats());

Jen.fill()

This function fill the random buffer line. You don't need to use it.

Contact