xaamin / hashing
Password hashing
Installs: 18
Dependents: 0
Suggesters: 0
Security: 0
Stars: 1
Watchers: 1
Forks: 0
Open Issues: 0
pkg:composer/xaamin/hashing
Requires
- php: >=5.0.0
Requires (Dev)
- phpunit/phpunit: ~4.0
Suggests
- ext-mcrypt: Required for more secure salt on hashes.
- ext-openssl: Required for more secure salt on hashes.
This package is auto-updated.
Last update: 2025-09-29 00:36:17 UTC
README
Installation
Require the package using composer
composer require xaamin/hashing
Usage
You may hash a password by calling the make method on Hash instance
use Xaamin\Hashing\Hash;
$password' => Hash::make('plain-text');
The check method allows you to verify that a given plain-text string corresponds to a given hash.
if (Hash::check('plain-text', $hashedValue))
{
// The passwords match...
}
By defautl this package uses the default PHP native hash implementation, it's the most secure way to hashing passwords and requires PHP 5 >= 5.5.0. Anyway, if you have PHP 5 < 5.5.0 you can use Bcrypt hashing algorithm. I suggest enable mcrypt or openssl PHP extension to generate secure random salt.
Hash::setHasher(new Xaamin\Hashing\Strategies\BcryptHash);