Password Hash Manager provides secure Bcrypt, Argon2i (PHP>=7.2) or Argon2id (PHP>=7.3) hashing for storing user passwords or etc.
- PHP 7
- Bcrypt (>= 5.5.0)
- Argon2i (>=7.2.0))
- Argon2id (>=7.3.0))
- Composer
Password Hash Manager installation is very simple. Open the terminal and run this command
composer require bariseser/password-hash
You can creates a new password hash using a strong one-way hashing algorithm
<?php
require '../vendor/autoload.php';
use Bariseser\hashmanager;
$hashManager = HashManager::getInstance()->initialize(HashManager::BCRYPT);
$hash = $driver->hash("Your Password");
echo $hash.PHP_EOL;
Verifies that a password matches a hash
<?php
require '../vendor/autoload.php';
use Bariseser\hashmanager;
$hashManager = HashManager::getInstance()->initialize(HashManager::ARGON2I);
if ($driver->validate("Your Password", $hash)) {
echo "Valid Password" . PHP_EOL;
} else {
echo "Invalid Password" . PHP_EOL;
}
Get hash info
<?php
require '../vendor/autoload.php';
use Bariseser\hashmanager;
$hashManager = HashManager::getInstance()->initialize(HashManager::ARGON2I);
$hash = $driver->hash("Your Password");
$info = $driver->getInfo($hash);
echo $hash.PHP_EOL;
print_r($info);
Switch Algorithm
<?php
$driver->setAlgorithm(HashManager::BCRYPT);
$driver->setAlgorithm(HashManager::ARGON2I);
$driver->setAlgorithm(HashManager::ARGON2ID);
- Bcrypt (>=5.5.0)
- Argon2I (>=7.2.0)
- Argon2ID (>=7.3.0)
1 - Fork the Project
2 - Ensure you have Composer installed (see Composer Download Instructions)
3 - Install Development Dependencies
composer install
4 - Run the Test Suite
vendor/bin/phpunit
5 - Send us a Pull Request