- crypt: documentation ( source)
<?php
$hash = '$2y$04$usesomesillystringfore7hnbRJHxXVLeakoG8K30oukPsA.ztMG';
$test = crypt("password", $hash);
echo "$2y string: $test\n";
$pass = ($test == $hash);
echo "$2y test status: " . ( $pass ? "Pass" : "Fail") . "\n";
$hash = '$2a$04$usesomesillystringfore7hnbRJHxXVLeakoG8K30oukPsA.ztMG';
$test = crypt("password", $hash);
echo "$2a string: $test\n";
$pass = ($test == $hash);
echo "$2a test status: " . ( $pass ? "Pass" : "Fail") . "\n";
$hash = '$2x$04$usesomesillystringfore7hnbRJHxXVLeakoG8K30oukPsA.ztMG';
$test = crypt("password", $hash);
echo "$2x string: $test\n";
$pass = ($test == $hash);
echo "$2x test status: " . ( $pass ? "Pass" : "Fail") . "\n";