- crypt: documentation ( source)
- array_unique: documentation ( source)
- array_pop: documentation ( source)
<?php
$str = '';
$hashes = array();
do {
$str .= '0';
$hashes[] = crypt($str, '$2y$04$1234567890123456789012');
if (count(array_unique($hashes)) === count($hashes))
$allUnique = true;
else
$allUnique = false;
} while($allUnique);
echo "Stopped at " . strlen($str) . " characters before truncation was detected...\n\n";
$lst = array_pop($hashes);
$stl = array_pop($hashes);
echo "$stl\n$lst";