3v4l.org

run code in 300+ PHP versions simultaneously
<?php /* * PHP mcrypt - Basic encryption and decryption of a string */ $string = "Some text to be encrypted"; $secret_key = "This is my secret key"; $encrypted_string1 ="brxeIzp7p60UsC6SSPXB1g=="; $secret_key1 = "SinigangNaManokMayHalongBaboy"; // Create the initialization vector for added security. $iv = mcrypt_create_iv(mcrypt_get_iv_size(MCRYPT_RIJNDAEL_256, MCRYPT_MODE_ECB), MCRYPT_RAND); // Encrypt $string $encrypted_string = mcrypt_encrypt(MCRYPT_RIJNDAEL_256, $secret_key, $string, MCRYPT_MODE_CBC, $iv); // Decrypt $string $decrypted_string = mcrypt_decrypt(MCRYPT_RIJNDAEL_192, $secret_key1, $encrypted_string1, MCRYPT_MODE_CBC, $iv); echo "Original string : " . $string . "<br />\n"; echo "Encrypted string : " . $encrypted_string . "<br />\n"; echo "Decrypted string1 : " . $decrypted_string . "<br />\n"; ?>
Output for 7.0.6 - 7.0.20, 7.1.0 - 7.1.20, 7.2.0 - 7.2.33, 7.3.16 - 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 mcrypt_create_iv() in /in/7W6ts:23 Stack trace: #0 {main} thrown in /in/7W6ts on line 23
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 mcrypt_create_iv() in /in/7W6ts:23 Stack trace: #0 {main} thrown in /in/7W6ts on line 23
Process exited with code 255.
Output for 5.6.0 - 5.6.20, 7.0.0 - 7.0.5
Warning: mcrypt_encrypt(): Key of size 21 not supported by this algorithm. Only keys of sizes 16, 24 or 32 supported in /in/7W6ts on line 30 Warning: mcrypt_decrypt(): Key of size 29 not supported by this algorithm. Only keys of sizes 16, 24 or 32 supported in /in/7W6ts on line 37 Original string : Some text to be encrypted<br /> Encrypted string : <br /> Decrypted string1 : <br />
Output for 5.5.35, 5.6.21 - 5.6.28
Fatal error: Call to undefined function mcrypt_create_iv() in /in/7W6ts on line 23
Process exited with code 255.
Output for 5.5.34
Warning: mcrypt_decrypt(): The IV parameter must be as long as the blocksize in /in/7W6ts on line 37 Original string : Some text to be encrypted<br /> Encrypted string : ��9rj��=f>�HlQ$Q�V#xS�Z(�.��!<br /> Decrypted string1 : ����o�����^�+����<br />
Output for 5.5.33
Warning: mcrypt_decrypt(): The IV parameter must be as long as the blocksize in /in/7W6ts on line 37 Original string : Some text to be encrypted<br /> Encrypted string : K��#����G� �v���w���/�!��I K�<br /> Decrypted string1 : ����o�����^�+����<br />
Output for 5.5.32
Warning: mcrypt_decrypt(): The IV parameter must be as long as the blocksize in /in/7W6ts on line 37 Original string : Some text to be encrypted<br /> Encrypted string : >Z�3�z# ��������+x���l�+<br /> Decrypted string1 : ����o�����^�+����<br />
Output for 5.5.31
Warning: mcrypt_decrypt(): The IV parameter must be as long as the blocksize in /in/7W6ts on line 37 Original string : Some text to be encrypted<br /> Encrypted string : � [��D����v���� ՚8�p�)�E����<br /> Decrypted string1 : ����o�����^�+����<br />
Output for 5.5.30
Warning: mcrypt_decrypt(): The IV parameter must be as long as the blocksize in /in/7W6ts on line 37 Original string : Some text to be encrypted<br /> Encrypted string : ?g� >��z0��䆕uw"�L��TG�;@<br /> Decrypted string1 : ����o�����^�+����<br />
Output for 5.5.29
Warning: mcrypt_decrypt(): The IV parameter must be as long as the blocksize in /in/7W6ts on line 37 Original string : Some text to be encrypted<br /> Encrypted string : �sꉮ0�b��D��Ei��6<_����F|��<br /> Decrypted string1 : ����o�����^�+����<br />
Output for 5.5.28
Warning: mcrypt_decrypt(): The IV parameter must be as long as the blocksize in /in/7W6ts on line 37 Original string : Some text to be encrypted<br /> Encrypted string : ��w�56T�-��NЎ-ܖU�v� �n�bI�A�<br /> Decrypted string1 : ����o�����^�+����<br />
Output for 5.5.27
Warning: mcrypt_decrypt(): The IV parameter must be as long as the blocksize in /in/7W6ts on line 37 Original string : Some text to be encrypted<br /> Encrypted string : �$�����u�~+�ߧ���Q��֨�.����}�$<br /> Decrypted string1 : ����o�����^�+����<br />
Output for 5.5.26
Warning: mcrypt_decrypt(): The IV parameter must be as long as the blocksize in /in/7W6ts on line 37 Original string : Some text to be encrypted<br /> Encrypted string : ���� j�S�{�����꺗�5wƅ��:<br /> Decrypted string1 : ����o�����^�+����<br />
Output for 5.5.25
Warning: mcrypt_decrypt(): The IV parameter must be as long as the blocksize in /in/7W6ts on line 37 Original string : Some text to be encrypted<br /> Encrypted string : � ���9��I��M�+D_�6i��:��=�8Ti<br /> Decrypted string1 : ����o�����^�+����<br />
Output for 5.5.24
Warning: mcrypt_decrypt(): The IV parameter must be as long as the blocksize in /in/7W6ts on line 37 Original string : Some text to be encrypted<br /> Encrypted string : C�H�Hp�<i� ��'�3�?��� s�U8<br /> Decrypted string1 : ����o�����^�+����<br />
Output for 5.5.23
Warning: mcrypt_decrypt(): The IV parameter must be as long as the blocksize in /in/7W6ts on line 37 Original string : Some text to be encrypted<br /> Encrypted string : �;�;y���p��t��`ƙGe��C�oDə�<br /> Decrypted string1 : ����o�����^�+����<br />
Output for 5.5.22
Warning: mcrypt_decrypt(): The IV parameter must be as long as the blocksize in /in/7W6ts on line 37 Original string : Some text to be encrypted<br /> Encrypted string : ����!����a�}�����X��(�c�\�<br /> Decrypted string1 : ����o�����^�+����<br />
Output for 5.5.21
Warning: mcrypt_decrypt(): The IV parameter must be as long as the blocksize in /in/7W6ts on line 37 Original string : Some text to be encrypted<br /> Encrypted string : �@p˰p>HX6�っ��Ȕs)"��>��3 �<br /> Decrypted string1 : ����o�����^�+����<br />
Output for 5.5.20
Warning: mcrypt_decrypt(): The IV parameter must be as long as the blocksize in /in/7W6ts on line 37 Original string : Some text to be encrypted<br /> Encrypted string : =2�a�*���E$LT�KwG�`�����I��D�<br /> Decrypted string1 : ����o�����^�+����<br />
Output for 5.5.19
Warning: mcrypt_decrypt(): The IV parameter must be as long as the blocksize in /in/7W6ts on line 37 Original string : Some text to be encrypted<br /> Encrypted string : ����+�~<'�T=s�m�PE0^-r�J�*U �<br /> Decrypted string1 : ����o�����^�+����<br />
Output for 5.5.18
Warning: mcrypt_decrypt(): The IV parameter must be as long as the blocksize in /in/7W6ts on line 37 Original string : Some text to be encrypted<br /> Encrypted string : �p��������Ը~���G�r��Ն�K�+��<br /> Decrypted string1 : ����o�����^�+����<br />
Output for 5.5.16
Warning: mcrypt_decrypt(): The IV parameter must be as long as the blocksize in /in/7W6ts on line 37 Original string : Some text to be encrypted<br /> Encrypted string : ���Jݮ_ʜ��Y�A�E���#��ZW�D�t<br /> Decrypted string1 : ����o�����^�+����<br />
Output for 5.5.15
Warning: mcrypt_decrypt(): The IV parameter must be as long as the blocksize in /in/7W6ts on line 37 Original string : Some text to be encrypted<br /> Encrypted string : ��v�B��Į$*ƅ[B�'��8�� F�<br /> Decrypted string1 : ����o�����^�+����<br />
Output for 5.5.14
Warning: mcrypt_decrypt(): The IV parameter must be as long as the blocksize in /in/7W6ts on line 37 Original string : Some text to be encrypted<br /> Encrypted string : ���$�pv�9m��z͸3J��z>}��m�yR�(<br /> Decrypted string1 : ����o�����^�+����<br />
Output for 5.5.13
Warning: mcrypt_decrypt(): The IV parameter must be as long as the blocksize in /in/7W6ts on line 37 Original string : Some text to be encrypted<br /> Encrypted string : �v���L�m���Զx�����6����c��(<br /> Decrypted string1 : ����o�����^�+����<br />
Output for 5.5.12
Warning: mcrypt_decrypt(): The IV parameter must be as long as the blocksize in /in/7W6ts on line 37 Original string : Some text to be encrypted<br /> Encrypted string : �Ds������6��fo�굾��Ҙ�T)����>x<br /> Decrypted string1 : ����o�����^�+����<br />
Output for 5.5.11
Warning: mcrypt_decrypt(): The IV parameter must be as long as the blocksize in /in/7W6ts on line 37 Original string : Some text to be encrypted<br /> Encrypted string : ��H�t$����p�~Kw�>���@%M"[<br /> Decrypted string1 : ����o�����^�+����<br />
Output for 5.5.10
Warning: mcrypt_decrypt(): The IV parameter must be as long as the blocksize in /in/7W6ts on line 37 Original string : Some text to be encrypted<br /> Encrypted string : ���D�p5� >:�R�*��Y�� ΀@�<br /> Decrypted string1 : ����o�����^�+����<br />
Output for 5.5.9
Warning: mcrypt_decrypt(): The IV parameter must be as long as the blocksize in /in/7W6ts on line 37 Original string : Some text to be encrypted<br /> Encrypted string : tQ���(+��ie��z�_�$���dY��m��<br /> Decrypted string1 : ����o�����^�+����<br />
Output for 5.5.8
Warning: mcrypt_decrypt(): The IV parameter must be as long as the blocksize in /in/7W6ts on line 37 Original string : Some text to be encrypted<br /> Encrypted string : 31�ͮʾ6B�9�I$&v�ϳo'�=F�E�b<br /> Decrypted string1 : ����o�����^�+����<br />
Output for 5.5.7
Warning: mcrypt_decrypt(): The IV parameter must be as long as the blocksize in /in/7W6ts on line 37 Original string : Some text to be encrypted<br /> Encrypted string : c[��T��H�X��,����Y�& �7��Y��<br /> Decrypted string1 : ����o�����^�+����<br />
Output for 5.5.6
Warning: mcrypt_decrypt(): The IV parameter must be as long as the blocksize in /in/7W6ts on line 37 Original string : Some text to be encrypted<br /> Encrypted string : ��B9���1�T ���]�1��H~� �h!��<br /> Decrypted string1 : ����o�����^�+����<br />
Output for 5.5.5
Warning: mcrypt_decrypt(): The IV parameter must be as long as the blocksize in /in/7W6ts on line 37 Original string : Some text to be encrypted<br /> Encrypted string : �PJ��c��dp��[zLv]�E@��ݟ _9�<br /> Decrypted string1 : ����o�����^�+����<br />
Output for 5.5.4
Warning: mcrypt_decrypt(): The IV parameter must be as long as the blocksize in /in/7W6ts on line 37 Original string : Some text to be encrypted<br /> Encrypted string : U��(�o 3�^���5�l l��[JY߮�8k��<br /> Decrypted string1 : ����o�����^�+����<br />
Output for 5.5.3
Warning: mcrypt_decrypt(): The IV parameter must be as long as the blocksize in /in/7W6ts on line 37 Original string : Some text to be encrypted<br /> Encrypted string : �~�V�%��� ^��\>�|YX�'W�g%r<br /> Decrypted string1 : ����o�����^�+����<br />
Output for 5.5.2
Warning: mcrypt_decrypt(): The IV parameter must be as long as the blocksize in /in/7W6ts on line 37 Original string : Some text to be encrypted<br /> Encrypted string : :���`0Z5 ���q3�x��v����S�0C�+<br /> Decrypted string1 : ����o�����^�+����<br />
Output for 5.5.1
Warning: mcrypt_decrypt(): The IV parameter must be as long as the blocksize in /in/7W6ts on line 37 Original string : Some text to be encrypted<br /> Encrypted string : 2e�.͆~�3�Se����}z�c;���<br /> Decrypted string1 : ����o�����^�+����<br />
Output for 5.5.0
Warning: mcrypt_decrypt(): The IV parameter must be as long as the blocksize in /in/7W6ts on line 37 Original string : Some text to be encrypted<br /> Encrypted string : '�,όJ��i� /�:ĎlY�l�s�����<br /> Decrypted string1 : ����o�����^�+����<br />

preferences:
186.67 ms | 402 KiB | 214 Q