2017 © Pedro Peláez
 

library php-password-toolbox

A simple toolkit for generate, analyse and hash passwords with PHP.

image

ryanj93/php-password-toolbox

A simple toolkit for generate, analyse and hash passwords with PHP.

  • Saturday, February 24, 2018
  • by ryanj93
  • Repository
  • 1 Watchers
  • 2 Stars
  • 2 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 1 Forks
  • 0 Open issues
  • 3 Versions
  • 0 % Grown

The README.md

Password toolkit (PHP edition)

Password toolkit is a simple library that will help you handling passwords with PHP without any dependencies. This library is a PHP porting from the "Password toolkit" library available for Node.js. You can use this library to generate suggested passwords, analyse user provided passwords in order to get a strength score and create a hash that can be stored within the database. Note that this library require PHP version 7.0 or greater., (*1)

Password analysis

First, you need to create an instance of the "Analyzer" class as following:, (*2)

$analyzer = new PHPPasswordToolBox\Analyzer();, (*3)

Simple analysis:, (*4)

$analyzer->analyze($password);, (*5)

Complete analysis:, (*6)

$analyzer->setDictionaryPath('rockyou.txt')->completeAnalysis($password);, (*7)

Note that the complete analysis require a dictionary containing a list of weak passwords, passwords in this list must be separated by a break line (\n). You can download dictionaries here. Both methods will return an associative array containing informations about chars count, keywords and the score., (*8)

Password generation

First, you need to create an instance of the "Generator" class as following:, (*9)

$generator = new PHPPasswordToolBox\Generator();, (*10)

Random password:, (*11)

$generator->generate(12);, (*12)

Human readable password generation:, (*13)

$generator->setDictionaryPath('dictionary.txt')->generateHumanReadable(12, 2);, (*14)

Note that in order to generate human readable passwords you need a dictionary, words in the dictionary must be separated by a break line (\n). If you are looking for an English word list, give a look here., (*15)

Password hashing

Simple hash generation:, (*16)

PHPPasswordToolBox\Hash::createSimpleHash($password);, (*17)

More complex hash generation:, (*18)

PHPPasswordToolBox\Hash::createHash($password);, (*19)

The first method will return the hash as a string, the second one will return an associative array with the hash and its parameters (salts, algorithm, loop number). If you need to compare a given password and a hash generated with the first method you can use this method:, (*20)

PHPPasswordToolBox\Hash::compareSimpleHash($password, $hash);, (*21)

While if you used the second method you can do this:, (*22)

PHPPasswordToolBox\Hash::compareHash($password, $hash);, (*23)

Are you looking for the Node.js version? Give a look here., (*24)

The Versions

24/02 2018

dev-master

9999999-dev https://github.com/RyanJ93/php-password-toolbox#readme

A simple toolkit for generate, analyse and hash passwords with PHP.

  Sources   Download

GPL-3.0-or-later

The Requires

  • php >=7.0

 

The Development Requires

  • php >=7.0

validator security generator password encryption crypt hash utilities random hashing

24/02 2018

1.1.4

1.1.4.0 https://github.com/RyanJ93/php-password-toolbox#readme

A simple toolkit for generate, analyse and hash passwords with PHP.

  Sources   Download

GPL-3.0-or-later

The Requires

  • php >=7.0

 

The Development Requires

  • php >=7.0

validator security generator password encryption crypt hash utilities random hashing

19/02 2018

1.1.3

1.1.3.0 https://github.com/RyanJ93/php-password-toolbox#readme

A simple toolkit for generate, analyse and hash passwords with PHP.

  Sources   Download

GPL-3.0-or-later

The Requires

  • php >=7.0

 

The Development Requires

  • php >=7.0

validator security generator password encryption crypt hash utilities random hashing