3v4l.org

run code in 300+ PHP versions simultaneously
<?php define('SECRET', 'private-key'); $payload = [ "id" => 1, "username" => "test@example.com", "created_at" => "2018-10-11 13:30:29", "updated_at" => "2018-10-17 11:17:14" ]; echo verifySignature(SECRET, 'https://example.com/webhook', $payload, 1517949000); function verifySignature(string $secret, string $webhookUrl, array $payload, int $timestamp): string { $jsonPayload = json_encode($payload); $stringToSign = "NORDWL-HMAC-SHA256\n"; $stringToSign .= sprintf("Timestamp %d\n", $timestamp); $stringToSign .= hash('sha256', $jsonPayload); $timestampKey = hash_hmac('sha256', $timestamp, 'NORDWL' . $secret, true); $signingKey = hash_hmac('sha256', $webhookUrl, $timestampKey, true); return hash_hmac('sha256', $stringToSign, $signingKey); }
Output for git.master_jit, git.master, rfc.property-hooks
61994df60c552042e781c3c1acf5100d553647c668c1ef230bf8be585b8cff0c

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:
65.31 ms | 401 KiB | 8 Q