The Quantum Hasher library make it easy to hash and verify your passwords using modern, secure and robust hashing algorithms.

To start using the library you need to make it available in your controller and create new `Hasher` instance..

use Quantum\Libraries\Hasher\Hasher;


$hasher = new Hasher();



By default the Hasher library uses Bcrypt algorithm with cost=12 to hash the password.

To set other algorithm you can use:



To change the cost you can use:



The hash($password) method will return a hash of the provided password

$hashed = $hasher->hash('foobar');


The check($password, $hash) method will verifiy if the password matches to the hash

if($hasher->check('foobar', $hashed)) {
    // matched
} else {
    // not matched


The needsRehash($hash) method returns true if the provided hash needs to be rehashed otherwise false will be returned

$needsRehash = $hasher->needsRehash($hashed);


The info($hash) method returns info about the hash


<< Prev Next >>