3v4l.org

run code in 300+ PHP versions simultaneously
<?php $packed = '{"nonce":"xobK27GhMR960tSTcg5nrFSy35uwkKYn","key":"px2BaIAx17vdBQFdnLBimERK6KHqHNxhJN0PzKfhMHE","secretbox":"RFgczAJ_L0hOpIb_O0k9dFE58Cz-dagdEA3aHxUq_Q6jCEzTdzlMQyI7jEoauWOlH7m3EEXv4OFiD-Ke3otsoLJV0TPFbV2HV59pGNsSux9e"}'; $decoded = json_decode($packed, true); function base64url_decode(string $str): string { return base64_decode(strtr($str, '-_', '+/')); } $nonce = base64url_decode($decoded['nonce']); $key = base64url_decode($decoded['key']); $secretbox = base64url_decode($decoded['secretbox']); var_dump(sodium_crypto_secretbox_open($secretbox, $nonce, $key));
Output for 7.2.0 - 7.2.34, 7.3.0 - 7.3.33, 7.4.0 - 7.4.30, 8.0.0 - 8.0.22, 8.1.0 - 8.1.9
string(65) "don't mind me, just a feline getting comfy in this secretbox 🐱"

preferences:
53.36 ms | 409 KiB | 5 Q