PHP code example of lablnet / hashing

1. Go to this page and download the library: Download lablnet/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/ */

    

lablnet / hashing example snippets


 
use Lablnet\Hashing;

//Original password
$password = 123456;
//Hash the password
$password_hash = $hashing->make($password);
echo $password_hash;

$hashing = new Hashing('bcrypt');
$password_hash = $hashing->make($password, [
    'cost' => 12
]);

$hashing = new Hashing('argon2i');
$password_hash = $hashing->make($password, [
    'memory' => 1024,
    'time' => 2,
    'threads' => 2,
]);

if ($hashing->verify($password,$password_hash)) {
	//The password matched.
}

if ($hashing->needsRehash($hashed)) {
    $password_hash = $hashing->make($password);
}

$hashing = new Hashing('supported-algorithm');
$bvcryptHashing = new Hashing('bcrypt');


//Argon2
$argon2Hashing = new Hashing('argon2i',[
    'memory' => 1024,
    'time' => 2,
    'threads' => 2,
    'verify' => false,
]);

//Bcrypt
$vcryptHashing = new Hashing('bcrypt'[
    'cost' => 12,
    'verify' => false,
]);