3v4l.org

run code in 300+ PHP versions simultaneously
<?php function aesCtr(string $m, string $n, string $k): string { return \openssl_decrypt($m, 'aes-128-ctr', $k, OPENSSL_RAW_DATA, $n); } $messages = [ 'wGVEtlgIETc4E4SNly0b7viJAv3bpO/85lC5/XCssVnMlrPc+TxeI+Jrsl+wVwQVOKbCEw8=', '2GxE9VRBC3giH5XMiSQXvfnGAeGHBqlXABl1mHrcabUCi8PLNlZCe+K1+3M9Vvb9nJo0AjHjuYkARV9h8WRywgFg+VSWKLb0K0lg+ZBVN70sJ+GRLrB6mCUK/ZeYucA=', '1mgX9w0TFzd2Ty69vfYaKmioBx7KaZoHHuCYCOEG519T2EQs6HJMIIle' ]; $key = hash('sha256', 'spottycats', true); $nonce = str_repeat("\0", 16); // First, remove the base64 decoding: $base64decoded = [ base64_decode($messages[0]), base64_decode($messages[1]), base64_decode($messages[2]) ]; // The last 32 bytes are a HMAC. We can strip that. $stripLast32 = [ mb_substr($base64decoded[0], 0, -32, '8bit'), mb_substr($base64decoded[1], 0, -32, '8bit'), mb_substr($base64decoded[2], 0, -32, '8bit') ]; var_dump( bin2hex($stripLast32[0]), bin2hex($stripLast32[1]), bin2hex($stripLast32[2]), aesCtr($messages[0], $nonce, $key), aesCtr($messages[1], $nonce, $key), aesCtr($messages[2], $nonce, $key) );
Output for 7.1.20 - 7.1.33, 7.2.0 - 7.2.33, 7.3.0 - 7.3.33, 7.4.0 - 7.4.33, 8.0.0 - 8.0.30, 8.1.0 - 8.1.28, 8.2.0 - 8.2.18, 8.3.0 - 8.3.4, 8.3.6
Fatal error: Uncaught Error: Call to undefined function openssl_decrypt() in /in/iX61P:4 Stack trace: #0 /in/iX61P(34): aesCtr('wGVEtlgIETc4E4S...', '\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00...', ''\xBAa\x13\x1A\xC1\x80\xB9\xC0>C\x9D\xD8\e\xC5...') #1 {main} thrown in /in/iX61P on line 4
Process exited with code 255.
Output for 8.3.5
Warning: PHP Startup: Unable to load dynamic library 'sodium.so' (tried: /usr/lib/php/8.3.5/modules/sodium.so (libsodium.so.23: cannot open shared object file: No such file or directory), /usr/lib/php/8.3.5/modules/sodium.so.so (/usr/lib/php/8.3.5/modules/sodium.so.so: cannot open shared object file: No such file or directory)) in Unknown on line 0 Fatal error: Uncaught Error: Call to undefined function openssl_decrypt() in /in/iX61P:4 Stack trace: #0 /in/iX61P(34): aesCtr('wGVEtlgIETc4E4S...', '\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00...', ''\xBAa\x13\x1A\xC1\x80\xB9\xC0>C\x9D\xD8\e\xC5...') #1 {main} thrown in /in/iX61P on line 4
Process exited with code 255.
Output for 7.0.0 - 7.0.25, 7.1.0 - 7.1.11
string(42) "c06544b6580811373813848d972d1beef88902fddb" string(126) "d86c44f554410b78221f95cc892417bdf9c601e18706a957001975987adc69b5028bc3cb3656427be2b5fb733d56f6fd9c9a340231e3b98900455f61f16472" string(20) "d66817f70d131737764f" string(72) "�Ga� ^ (�ؾu1��W��P�u$O6�x�)�R��9c`c���5A��ξ8�ӏ@� z�C��i�" string(128) "�GO�A77UO���t:���6փ@�x$\B�J�j�&�{sQs��0 �ë�(;���Yd1�~>�B�s�t�(&Œ�����?p7�@� �g�9��Ȱ���' ��8jJ��BDN\��W7��8" string(56) "�mP�AUC �ޯ8T��>�K�P'A2�i�i�/���UtfW��kv�Ӣ &��"

preferences:
227.07 ms | 403 KiB | 224 Q