PHP Password Generator Class Toolbox: Generate, analyze and create hashes of passwords

Recommend this page to a friend!
  Info   View files Example   View files View files (5)   DownloadInstall with Composer Download .zip   Reputation   Support forum   Blog    
Ratings Unique User Downloads Download Rankings
Not enough user ratingsTotal: 158 All time: 8,771 This week: 284Up
Version License PHP version Categories
php-password-toolbox 1.0.0Custom (specified...5PHP 5, Text processing, Security
Description Author

This package can generate, analyze and create hashes of passwords.

It can generate a string that can be used as a password which may optionally be readable by people.

The package also generate a hash for the password, so it can be verified later if a given password entered by a user matches what the original password.

It may also analyze the password to tell if it matches certain characteristics like a certain length, types of characters that it contains or if it is already in a dictionary file of commonly used passwords.

Picture of Enrico Sola
Name: Enrico Sola <contact>
Classes: 5 packages by
Country: Italy Italy
Age: 27
All time rank: 3224128 in Italy Italy
Week rank: 633 Up31 in Italy Italy Up

Details

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.

Password analysis

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

$analyzer = new PHPPasswordToolBox\Analyzer();

Simple analysis:

$analyzer->analyze($password);

Complete analysis:

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

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.

Password generation

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

$generator = new PHPPasswordToolBox\Generator();

Random password:

$generator->generate(12);

Human readable password generation:

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

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.

Password hashing

Simple hash generation:

PHPPasswordToolBox\Hash::createSimpleHash($password);

More complex hash generation:

PHPPasswordToolBox\Hash::createHash($password);

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:

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

While if you used the second method you can do this:

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

Are you looking for the Node.js version? Give a look here.

  Files folder image Files  
File Role Description
Accessible without login Plain text file composer.json Data Auxiliary data
Accessible without login Plain text file demo.php Example Example script
Accessible without login Plain text file LICENSE.md Lic. License text
Plain text file php-password-toolbox.php Class Class source
Accessible without login Plain text file README.md Doc. Documentation

 Version Control Unique User Downloads Download Rankings  
 100%
Total:158
This week:0
All time:8,771
This week:284Up

For more information send a message to info at phpclasses dot org.