1. Go to this page and download the library: Download yarri/my-blowfish 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/ */
yarri / my-blowfish example snippets
$password = "honeyBump";
MyBlowfish::IsHash($password); // false
$hash = MyBlowfish::Filter($password);
MyBlowfish::IsHash($hash); // true
// A different salt is used automatically in another call of Filter().
// So the new hash from the same password differs from the old one.
$hash2 = MyBlowfish::Filter($password); // $hash2 !== $hash
// Filter() doesn't make hash from a hash!
$hash3 = MyBlowfish::Filter($hash); // $hash3 === $hash
// There is also method GetHash() which makes hash in every case.
$hash4 = MyBlowfish::GetHash($hash); // $hash4 !== $hash
MyBlowfish::CheckPassword($password, $hash); // true
MyBlowfish::CheckPassword("badTry", $hash); // false
MyBlowfish::CheckPassword($hash, $hash); // false
MyBlowfish::CheckPassword($password, $hash2); // true
MyBlowfish::CheckPassword($password, $hash4); // false
MyBlowfish::CheckPassword($hash, $hash4); // true
MyBlowfish::CheckPassword($password, $password); // false; 2nd param is not a blowfish hash
// min .. 4
// max .. 31
// optimal .. 10, 11, 12
// default .. 12
define('MY_BLOWFISH_ROUNDS', 12);