3v4l.org

run code in 300+ PHP versions simultaneously
<?php function hmac_compare(string $a, string $b): bool { $random = random_bytes(32); return hash_hmac('sha256', $a, $random) === hash_hmac('sha256', $b, $random); } $key = random_bytes(32); $x = hash_hmac('sha256', 'test', $key); $y = hash_hmac('sha256', 'test', $key); $z = hash_hmac('sha256', 'test2', $key); var_dump( hmac_compare($x, $y), // true hmac_compare($y, $z) );
Output for git.master, git.master_jit
bool(true) bool(false)

This tab shows result from various feature-branches currently under review by the php developers. Contact me to have additional branches featured.

Active branches

Archived branches

Once feature-branches are merged or declined, they are no longer available. Their functionality (when merged) can be viewed from the main output page


preferences:
23.8 ms | 405 KiB | 5 Q