PHP code example of spoova / hasher

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

    

spoova / hasher example snippets




use Spoova/Hasher/Hasher;

$Hasher = new Hasher;
 
$Hasher->setHash($data, $key);
 
$Hasher->setHash(['name' => 'foo'], 'some_secret_key');

$Hasher->hashFuncs(['md5', 'sha1', 'base64_encode']);
 
   $hash = $Hasher->hashify(); //process and return hash
   
 
   $hash = $Hasher->hashify(7); //run hashing 7 times
   
 
   $Hasher->randomize();
   $hash = $Hasher->hashify(); 
   
 
   $Hasher->randomize(time());
   $hash = $Hasher->hashify();
   
 
   $hash1 = $Hasher->hashify(); //new hash one
   $hash2 = $Hasher->hashify(); //new hash two
   $hash3 = $Hasher->hashify(); //new hash three 
   $hash4 = $Hasher->hashify(0); //new hash one (reset hash)
   $hash5 = $Hasher->hashify(); //new hash two
   
 
   $hash1 = $Hasher->hashify(); //new hash one
   $hash2 = $Hasher->hashify(); //new hash two
   $hash3 = $Hasher->hashify(); //new hash three 
   
   $hash4 = $Hasher->hashify(3); //new hash three
   
 
   $hash1 $Hasher->hashify(); //new hash one
   $hash2 $Hasher->hashify(); //new hash twp
   $hash3 $Hasher->hashify(false); //same as hash one above
   
 
   $hash = $Hasher->hashify(['md5', 'sha']);
   
 
   $hash = $Hasher->hashify(false, ['md5', 'sha']);
   
 
   $hash = $Hasher->randomHash(10); //random hash string of 10 characters
   
 
   $hash = $Hasher->randomHash(10, 'foo'); //random hash string of 10 characters using characters in 'foo' only
   
 
   $hash = $Hasher->randomHash("", 'foo', ['md5','sha1']); //random hash of 'foo' using specified functions.
   
$data
$key