PHP code example of denosyscore / hashing

1. Go to this page and download the library: Download denosyscore/hashing library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

denosyscore / hashing example snippets




enosys\Hashing\HashManager;

$hash = new HashManager(['driver' => 'bcrypt']);  // or 'argon2id'

$stored = $hash->make('correct horse battery staple');

var_dump($hash->check('correct horse battery staple', $stored));  // bool(true)
var_dump($hash->check('wrong password', $stored));                // bool(false)

if ($hash->needsRehash($stored)) {
    $stored = $hash->make('correct horse battery staple');
}