- time: documentation ( source)
<?php
function wp_fast_hash(
#[\SensitiveParameter]
string $message,
int $length = 24
): string {
$hashed = sodium_crypto_generichash( $message, '', $length );
return '$generic$' . sodium_bin2base64( $hashed, SODIUM_BASE64_VARIANT_URLSAFE_NO_PADDING );
}
for ($i = 24; $i < 64; ++$i) {
$hash = time() . ':' . wp_fast_hash('foo', $i);
if (strlen($hash) > 64) {
continue;
}
echo $i . " length -> " . strlen($hash) . ": " . $hash . PHP_EOL;
}