- crypt: documentation ( source)
- printf: documentation ( source)
<?php
$password = 'test';
// hash generated with PHP 5.3.7+
$hash = '$2y$14$MTIzNDU2Nzg5MDEyMzQ1NeWUUefVlefsTbFhsbqKFv/vPSZBrSFVm';
$result = crypt($password, $hash);
printf("Result hash %s (length %d)\n", $result, strlen($result));
if ($result === $hash) {
printf("Ok, verified.\n");
} else {
printf("Not verified.\n");
}