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_192, MCRYPT_MODE_CBC), MCRYPT_RAND); $iv1 = "SinigangNaManok"; // Encrypt $string $encrypted_string = mcrypt_encrypt(MCRYPT_RIJNDAEL_192, $secret_key1, $string, MCRYPT_MODE_CBC, $iv); // Decrypt $string $decrypted_string = mcrypt_decrypt(MCRYPT_RIJNDAEL_192, $secret_key1, $encrypted_string1, MCRYPT_MODE_CBC, $iv1); echo "Original string : " . $string . "<br />\n"; echo "Encrypted string : " . $encrypted_string . "<br />\n"; echo "Decrypted string1 : " . $decrypted_string . ""; ?>
Output for 7.0.6 - 7.0.20, 7.1.0 - 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 mcrypt_create_iv() in /in/Bn9Im:23 Stack trace: #0 {main} thrown in /in/Bn9Im 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/Bn9Im:23 Stack trace: #0 {main} thrown in /in/Bn9Im 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 29 not supported by this algorithm. Only keys of sizes 16, 24 or 32 supported in /in/Bn9Im on line 32 Warning: mcrypt_decrypt(): Key of size 29 not supported by this algorithm. Only keys of sizes 16, 24 or 32 supported in /in/Bn9Im on line 39 Original string : Some text to be encrypted<br /> Encrypted string : <br /> Decrypted string1 :
Output for 5.5.35, 5.6.21 - 5.6.28
Fatal error: Call to undefined function mcrypt_create_iv() in /in/Bn9Im 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/Bn9Im on line 39 Original string : Some text to be encrypted<br /> Encrypted string : k�3y }�J����UN�&˫�m6J���N���u3�5 ݼ���<br /> Decrypted string1 : ����o�����^�+����
Output for 5.5.33
Warning: mcrypt_decrypt(): The IV parameter must be as long as the blocksize in /in/Bn9Im on line 39 Original string : Some text to be encrypted<br /> Encrypted string : 7�&�BN�IB��A.!���;8�:��.ِ�-"���@a�g`�au@<br /> Decrypted string1 : ����o�����^�+����
Output for 5.5.32
Warning: mcrypt_decrypt(): The IV parameter must be as long as the blocksize in /in/Bn9Im on line 39 Original string : Some text to be encrypted<br /> Encrypted string : �V��0hz�%��Q�l��8!��i��Z ���,�6Ѕi�N�v%�N�ϼ�<br /> Decrypted string1 : ����o�����^�+����
Output for 5.5.31
Warning: mcrypt_decrypt(): The IV parameter must be as long as the blocksize in /in/Bn9Im on line 39 Original string : Some text to be encrypted<br /> Encrypted string : *��� ������e��6un��^.p�x�:@�V�;i��n"9w� �hT6<br /> Decrypted string1 : ����o�����^�+����
Output for 5.5.30
Warning: mcrypt_decrypt(): The IV parameter must be as long as the blocksize in /in/Bn9Im on line 39 Original string : Some text to be encrypted<br /> Encrypted string : �e�U��^�l<'3��?��c���Ƚ�]WH�'�gM�7�ɇI�Q�<br /> Decrypted string1 : ����o�����^�+����
Output for 5.5.29
Warning: mcrypt_decrypt(): The IV parameter must be as long as the blocksize in /in/Bn9Im on line 39 Original string : Some text to be encrypted<br /> Encrypted string : ��~{�F��T���G��}�ا��jS�:��ʲd7߾���/@<br /> Decrypted string1 : ����o�����^�+����
Output for 5.5.28
Warning: mcrypt_decrypt(): The IV parameter must be as long as the blocksize in /in/Bn9Im on line 39 Original string : Some text to be encrypted<br /> Encrypted string : v:�A�^鄚٠NUB��#�ؗ�67�l3D��)f �K��.�l�C���Ê<br /> Decrypted string1 : ����o�����^�+����
Output for 5.5.27
Warning: mcrypt_decrypt(): The IV parameter must be as long as the blocksize in /in/Bn9Im on line 39 Original string : Some text to be encrypted<br /> Encrypted string : �N� Ow�'N�;pt�!�y��Oaq����6�Q�)]�z�<br /> Decrypted string1 : ����o�����^�+����
Output for 5.5.26
Warning: mcrypt_decrypt(): The IV parameter must be as long as the blocksize in /in/Bn9Im on line 39 Original string : Some text to be encrypted<br /> Encrypted string : 2���H�*r��4O�^��7�֚hk�'7�l�}"Ϧ�~}��|<br /> Decrypted string1 : ����o�����^�+����
Output for 5.5.25
Warning: mcrypt_decrypt(): The IV parameter must be as long as the blocksize in /in/Bn9Im on line 39 Original string : Some text to be encrypted<br /> Encrypted string : 0�J� �{��v��qq�G �sej���e[�d��zR�;��U��<br /> Decrypted string1 : ����o�����^�+����
Output for 5.5.24
Warning: mcrypt_decrypt(): The IV parameter must be as long as the blocksize in /in/Bn9Im on line 39 Original string : Some text to be encrypted<br /> Encrypted string : �R'@tP_ʴg����l��5�O��l& JUI�J�8(���]L�}<br /> Decrypted string1 : ����o�����^�+����
Output for 5.5.23
Warning: mcrypt_decrypt(): The IV parameter must be as long as the blocksize in /in/Bn9Im on line 39 Original string : Some text to be encrypted<br /> Encrypted string : S����V@ �L�yRw�R�0�m���T����q���v����t#��<br /> Decrypted string1 : ����o�����^�+����
Output for 5.5.22
Warning: mcrypt_decrypt(): The IV parameter must be as long as the blocksize in /in/Bn9Im on line 39 Original string : Some text to be encrypted<br /> Encrypted string : t(ax4vȋ�: n����qu�j�p����]�8� �\�* �Į<br /> Decrypted string1 : ����o�����^�+����
Output for 5.5.21
Warning: mcrypt_decrypt(): The IV parameter must be as long as the blocksize in /in/Bn9Im on line 39 Original string : Some text to be encrypted<br /> Encrypted string : 5�")���U� b ��J���>)�ѭ�N��J����w��3Y؇<br /> Decrypted string1 : ����o�����^�+����
Output for 5.5.20
Warning: mcrypt_decrypt(): The IV parameter must be as long as the blocksize in /in/Bn9Im on line 39 Original string : Some text to be encrypted<br /> Encrypted string : a��ёu$�����h�'Vq�' �JL�g}_`Dv��Yw\��<�2}'<br /> Decrypted string1 : ����o�����^�+����
Output for 5.5.19
Warning: mcrypt_decrypt(): The IV parameter must be as long as the blocksize in /in/Bn9Im on line 39 Original string : Some text to be encrypted<br /> Encrypted string : ����^f�(�~�!���gb1D ��)�N�ݲ�+�b�Ahz<1��,��΃�N<br /> Decrypted string1 : ����o�����^�+����
Output for 5.5.18
Warning: mcrypt_decrypt(): The IV parameter must be as long as the blocksize in /in/Bn9Im on line 39 Original string : Some text to be encrypted<br /> Encrypted string : �8��>�� �T u+5���p�R�[4�0)� G�B��ǽB+ʅe��pl<br /> Decrypted string1 : ����o�����^�+����
Output for 5.5.16
Warning: mcrypt_decrypt(): The IV parameter must be as long as the blocksize in /in/Bn9Im on line 39 Original string : Some text to be encrypted<br /> Encrypted string : ��] q�v��DŽ�N"� ��ܛW֡��f k'�����^K�ܫ<br /> Decrypted string1 : ����o�����^�+����
Output for 5.5.15
Warning: mcrypt_decrypt(): The IV parameter must be as long as the blocksize in /in/Bn9Im on line 39 Original string : Some text to be encrypted<br /> Encrypted string : 2�G3<�*<��_A-vB� ��)��G"�c�֢1w�\i�T��<br /> Decrypted string1 : ����o�����^�+����
Output for 5.5.14
Warning: mcrypt_decrypt(): The IV parameter must be as long as the blocksize in /in/Bn9Im on line 39 Original string : Some text to be encrypted<br /> Encrypted string : �5"<��@k8k�Iȸ7�̛!���T������ S�2W���'�*lm�C;P<br /> Decrypted string1 : ����o�����^�+����
Output for 5.5.13
Warning: mcrypt_decrypt(): The IV parameter must be as long as the blocksize in /in/Bn9Im on line 39 Original string : Some text to be encrypted<br /> Encrypted string : 8x�Tsi�=�?������c��9 �Ԕ���t� ���v��c�Rh�_�<br /> Decrypted string1 : ����o�����^�+����
Output for 5.5.12
Warning: mcrypt_decrypt(): The IV parameter must be as long as the blocksize in /in/Bn9Im on line 39 Original string : Some text to be encrypted<br /> Encrypted string : �A��4C $�hS* �fkO�������?Ooc� ���DZ۾�����v�<br /> Decrypted string1 : ����o�����^�+����
Output for 5.5.11
Warning: mcrypt_decrypt(): The IV parameter must be as long as the blocksize in /in/Bn9Im on line 39 Original string : Some text to be encrypted<br /> Encrypted string : f$/���Y��5�/LZ��4s�4��1*ﵨI��N�'1z��ᘺ?�<br /> Decrypted string1 : ����o�����^�+����
Output for 5.5.10
Warning: mcrypt_decrypt(): The IV parameter must be as long as the blocksize in /in/Bn9Im on line 39 Original string : Some text to be encrypted<br /> Encrypted string : �5s����&����0S���oğ4�6�,�|oc��̦_�e�I,��<br /> Decrypted string1 : ����o�����^�+����
Output for 5.5.9
Warning: mcrypt_decrypt(): The IV parameter must be as long as the blocksize in /in/Bn9Im on line 39 Original string : Some text to be encrypted<br /> Encrypted string : �� Ბ��m���$_K�̦����l�$8B�Al��f�F����<br /> Decrypted string1 : ����o�����^�+����
Output for 5.5.8
Warning: mcrypt_decrypt(): The IV parameter must be as long as the blocksize in /in/Bn9Im on line 39 Original string : Some text to be encrypted<br /> Encrypted string : ��XP�U�������vT��'�/k��Lw�O_�f����8��]n<br /> Decrypted string1 : ����o�����^�+����
Output for 5.5.7
Warning: mcrypt_decrypt(): The IV parameter must be as long as the blocksize in /in/Bn9Im on line 39 Original string : Some text to be encrypted<br /> Encrypted string : �K[B����� b|��F�q�'X� /�L����c�]��@"Va��m<br /> Decrypted string1 : ����o�����^�+����
Output for 5.5.6
Warning: mcrypt_decrypt(): The IV parameter must be as long as the blocksize in /in/Bn9Im on line 39 Original string : Some text to be encrypted<br /> Encrypted string : �C�T� �w�ʙ:l":��;� VHҊ�;�Tx� ^�M9i�=tI�6<br /> Decrypted string1 : ����o�����^�+����
Output for 5.5.5
Warning: mcrypt_decrypt(): The IV parameter must be as long as the blocksize in /in/Bn9Im on line 39 Original string : Some text to be encrypted<br /> Encrypted string : �{���qU�� a���yFxYe~��+��� �~�Q֪�PU*`i6"���<br /> Decrypted string1 : ����o�����^�+����
Output for 5.5.4
Warning: mcrypt_decrypt(): The IV parameter must be as long as the blocksize in /in/Bn9Im on line 39 Original string : Some text to be encrypted<br /> Encrypted string : XƩ��R�85��� ׻��{0�$�����ͺ�r��-�U���yY�<br /> Decrypted string1 : ����o�����^�+����
Output for 5.5.3
Warning: mcrypt_decrypt(): The IV parameter must be as long as the blocksize in /in/Bn9Im on line 39 Original string : Some text to be encrypted<br /> Encrypted string : � �=ZZUF8�r��g�I@�o0bK�@��AQ�&éh����CS%��<br /> Decrypted string1 : ����o�����^�+����
Output for 5.5.2
Warning: mcrypt_decrypt(): The IV parameter must be as long as the blocksize in /in/Bn9Im on line 39 Original string : Some text to be encrypted<br /> Encrypted string : �TV�7���K�!˝��΀�"�gC�oK27!��x��so ��<br /> Decrypted string1 : ����o�����^�+����
Output for 5.5.1
Warning: mcrypt_decrypt(): The IV parameter must be as long as the blocksize in /in/Bn9Im on line 39 Original string : Some text to be encrypted<br /> Encrypted string : 1~�� ��!;��~���[��eU+43o��e�f�^���A�-h�q_�<br /> Decrypted string1 : ����o�����^�+����
Output for 5.5.0
Warning: mcrypt_decrypt(): The IV parameter must be as long as the blocksize in /in/Bn9Im on line 39 Original string : Some text to be encrypted<br /> Encrypted string : �\�!;�@�t�|1�N6�7�I$1N�ڻB��R�A�l�T���z�o�<br /> Decrypted string1 : ����o�����^�+����

preferences:
224.11 ms | 402 KiB | 260 Q