2017 © Pedro Peláez
 

library passwordgen

A simple password generation class

image

zeraphie/passwordgen

A simple password generation class

  • Tuesday, August 1, 2017
  • by zeraphie
  • Repository
  • 1 Watchers
  • 0 Stars
  • 24 Installations
  • JavaScript
  • 0 Dependents
  • 0 Suggesters
  • 1 Forks
  • 0 Open issues
  • 16 Versions
  • 14 % Grown

The README.md

PasswordGen

A simple class for cryptographically strong secure password generation, (*1)

Installation - Composer

This class is available as a package using composer, just run, (*2)

composer require zeraphie/passwordgen

Javascript

This also comes as an bower package written in javascript, compiled with gulp as it uses ES2015 for a class structure and thusly has almost exactly the same usage, (*3)

To install it, run, (*4)

bower install passwordgen

Usage

Setup

PHP

// Require the autoloader
require_once __DIR__ . '/../vendor/autoload.php';

use PasswordGen\PasswordGen;
$passwordGen = new PasswordGen();

Javascript

Simply add the build/master.js file to your build tool or add the file directly into your html and it will be ready to be used as below, (*5)

Basic

PHP

echo $passwordGen->password();

JavaScript

console.log(new PasswordGen().password);

Changing the length

PHP

echo $passwordGen->setLength(32)->password();

JavaScript

console.log(new PasswordGen().setLength(32).password);

Changing the keyspace

PHP

echo $passwordGen->setKeyspace('abcdefghijklmnopqrstuvwxyz')->password();

JavaScript

console.log(new PasswordGen().setKeyspace('abcdefghijklmnopqrstuvwxyz').password);

Generating a keyspace

PHP

echo $passwordGen->generateKeyspace('lunsw')->password();

JavaScript

console.log(new PasswordGen().generateKeyspace('lunsw').password);

Changing length and generating keyspace

PHP

echo $passwordGen->setLength(32)->generateKeyspace('lunsw')->password();

JavaScript

console.log(new PasswordGen().setLength(32).generateKeyspace('lunsw').password);

Note: The two setters are independent of each other so don't need to be in order Note 2: Since the javascript version utilizes static getters, you can simply use (as an example to see the character sets used in the generator) PasswordGen.CHARACTERSETS in order to see what the properties of the class are. You can also use PasswordGen.arrayKeySearch(needles, haystack) and PasswordGen.randomInteger(min, max), (*6)

Character Groups

Group Variable Letter
LOWERCASELETTERS 'abcdefghijklmnopqrstuvwxyz' l
UPPERCASELETTERS 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' u
NUMBERS '1234567890' n
SPECIALCHARACTERS '!@#$%&*?,./\ []{}()' | s
WHITESPACE ' ' w

The Versions

01/08 2017

dev-master

9999999-dev

A simple password generation class

  Sources   Download

MIT

The Requires

 

by Izzy Skye

password generation random pseudorandom

01/08 2017

1.5.3

1.5.3.0

A simple password generation class

  Sources   Download

MIT

The Requires

 

by Izzy Skye

password generation random pseudorandom

10/04 2017

1.5.2

1.5.2.0

A simple password generation class

  Sources   Download

MIT

The Requires

 

by Izzy Skye

password generation random pseudorandom

30/03 2017

1.5.1

1.5.1.0

A simple password generation class

  Sources   Download

MIT

The Requires

 

by Tony Lopez

password generation random pseudorandom

30/03 2017

1.5.0

1.5.0.0

A simple password generation class

  Sources   Download

MIT

The Requires

 

by Tony Lopez

password generation random pseudorandom

05/09 2016

1.4.2

1.4.2.0

A simple password generation class

  Sources   Download

MIT

The Requires

 

by Tony Lopez

password generation random pseudorandom

05/09 2016

1.4.1

1.4.1.0

A simple password generation class

  Sources   Download

MIT

The Requires

 

by Tony Lopez

password generation random pseudorandom

04/09 2016

1.4.0

1.4.0.0

A simple password generation class

  Sources   Download

MIT

The Requires

 

by Tony Lopez

password generation random pseudorandom

23/08 2016

1.3.0

1.3.0.0

A simple password generation class

  Sources   Download

MIT

The Requires

 

by Tony Lopez

password generation random pseudorandom

16/08 2016

1.2.2

1.2.2.0

A simple password generation class

  Sources   Download

MIT

The Requires

 

by Tony Lopez

password generation random pseudorandom

16/08 2016

1.2.1

1.2.1.0

A simple password generation class

  Sources   Download

MIT

The Requires

 

by Tony Lopez

password generation random pseudorandom

15/08 2016

dev-dev-master

dev-dev-master

A simple password generation class

  Sources   Download

MIT

The Requires

 

by Tony Lopez

password generation random pseudorandom

15/08 2016

1.2.0

1.2.0.0

A simple password generation class

  Sources   Download

MIT

The Requires

 

by Tony Lopez

password generation random pseudorandom

15/08 2016

1.1.0

1.1.0.0

A simple password generation class

  Sources   Download

MIT

The Requires

 

by Tony Lopez

password generation random pseudorandom

12/08 2016

1.0.1

1.0.1.0

A simple password generation class

  Sources   Download

MIT

The Requires

 

by Tony Lopez

password generation random pseudorandom

12/08 2016

1.0.0

1.0.0.0

A simple password generation class

  Sources   Download

MIT

The Requires

 

by Tony Lopez

password generation random pseudorandom