3v4l.org

run code in 300+ PHP versions simultaneously
<?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; }
Output for 8.2.18 - 8.2.27, 8.3.5 - 8.3.17, 8.4.1 - 8.4.4
24 length -> 52: 1740184406:$generic$vzuq2EdyZZH4G-fsTsX7gBkXOgfCu-ek 25 length -> 54: 1740184406:$generic$MlanobNtQaRx8HXZnwq6CmaUDEJjmcgZJQ 26 length -> 55: 1740184406:$generic$QxGhWjd9gMrq0x66PzEwEEbhSdoczBA6m7w 27 length -> 56: 1740184406:$generic$SAJZm3RwdFMCQpXi_pe5eQrJPOu7YmbUFRtQ 28 length -> 58: 1740184406:$generic$hTmGs_4jHXlSYbT7Uw4akYjbQeRg7Eylmq_veA 29 length -> 59: 1740184406:$generic$tO2KaPa04SKPIF4Q-T0dlcWO2WTrsvANmdN-Pds 30 length -> 60: 1740184406:$generic$sVp5R9zHdzj06Fj7wj-LqFVswYWiswCAhsBytCzt 31 length -> 62: 1740184406:$generic$iYYchk6rnDATsqK94bTXlOXIzNb0sorQ_Gljy43bDA 32 length -> 63: 1740184406:$generic$uP6ff2JVpvoI9mirYyqNCBrYeYPHfNJ05IzkUPCzSf0 33 length -> 64: 1740184406:$generic$WnZVUkuc9-s0ToXWmM62M7OfWObRAW7BEbD65HlHomlH
Output for 8.2.0 - 8.2.17, 8.3.0 - 8.3.4
Fatal error: Uncaught Error: Call to undefined function sodium_bin2base64() in /in/gP6lT:9 Stack trace: #0 /in/gP6lT(13): wp_fast_hash(Object(SensitiveParameterValue), 24) #1 {main} thrown in /in/gP6lT on line 9
Process exited with code 255.

preferences:
49.46 ms | 408 KiB | 5 Q