3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?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 ="Eg3sU9wCCcqEs2a22g1aCQcEU8ea5QmmOEakamskkQQ177a3Cec13k1QKEOa95EQ"; $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 . ""; ?>
based on Bn9Im
Output for 7.0.6 - 7.3.0rc4
Fatal error: Uncaught Error: Call to undefined function mcrypt_create_iv() in /in/cnPWI:23 Stack trace: #0 {main} thrown in /in/cnPWI 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/cnPWI 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/cnPWI 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/cnPWI 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/cnPWI on line 39 Original string : Some text to be encrypted<br /> Encrypted string : �Fdh��p��vs�4~���{�ܑ2��/N��k+��A�]y�`p�uX<br /> Decrypted string1 : -ǀ|E�{��P��\�Tn�GF� �8%�-�� ���ᢐk�ie��g��̤5�!"�C�څ�s0N�P�{
Output for 5.5.33
Warning: mcrypt_decrypt(): The IV parameter must be as long as the blocksize in /in/cnPWI on line 39 Original string : Some text to be encrypted<br /> Encrypted string : �I����_�����r�ij&W�Gpi���������!&�� o�w�<br /> Decrypted string1 : -ǀ|E�{��P��\�Tn�GF� �8%�-�� ���ᢐk�ie��g��̤5�!"�C�څ�s0N�P�{
Output for 5.5.32
Warning: mcrypt_decrypt(): The IV parameter must be as long as the blocksize in /in/cnPWI on line 39 Original string : Some text to be encrypted<br /> Encrypted string : �7���W8��z�˥-��h�l�� �*A-`�`1Fl/��� ߹��<br /> Decrypted string1 : -ǀ|E�{��P��\�Tn�GF� �8%�-�� ���ᢐk�ie��g��̤5�!"�C�څ�s0N�P�{
Output for 5.5.31
Warning: mcrypt_decrypt(): The IV parameter must be as long as the blocksize in /in/cnPWI on line 39 Original string : Some text to be encrypted<br /> Encrypted string : ��3y/��&�\�9d)�B@�#\�Xo�;᭢'����9&��S�<br /> Decrypted string1 : -ǀ|E�{��P��\�Tn�GF� �8%�-�� ���ᢐk�ie��g��̤5�!"�C�څ�s0N�P�{
Output for 5.5.30
Warning: mcrypt_decrypt(): The IV parameter must be as long as the blocksize in /in/cnPWI on line 39 Original string : Some text to be encrypted<br /> Encrypted string : ��� aM�o�������ܙ[�(N� �̠%����k4)(:��`uA��<br /> Decrypted string1 : -ǀ|E�{��P��\�Tn�GF� �8%�-�� ���ᢐk�ie��g��̤5�!"�C�څ�s0N�P�{
Output for 5.5.29
Warning: mcrypt_decrypt(): The IV parameter must be as long as the blocksize in /in/cnPWI on line 39 Original string : Some text to be encrypted<br /> Encrypted string : �E[)޹��=E�˲��X�����ҕ"�>(ۄL�j�¥�%�>��+���<br /> Decrypted string1 : -ǀ|E�{��P��\�Tn�GF� �8%�-�� ���ᢐk�ie��g��̤5�!"�C�څ�s0N�P�{
Output for 5.5.28
Warning: mcrypt_decrypt(): The IV parameter must be as long as the blocksize in /in/cnPWI on line 39 Original string : Some text to be encrypted<br /> Encrypted string : I��h/X�m�we�"0j \ZE!�r�vh^�#���Ǡ˞���<br /> Decrypted string1 : -ǀ|E�{��P��\�Tn�GF� �8%�-�� ���ᢐk�ie��g��̤5�!"�C�څ�s0N�P�{
Output for 5.5.27
Warning: mcrypt_decrypt(): The IV parameter must be as long as the blocksize in /in/cnPWI on line 39 Original string : Some text to be encrypted<br /> Encrypted string : =4:y� Խ�����̐�|˒DBȇpA�Q��> O �L��b�Hw�<br /> Decrypted string1 : -ǀ|E�{��P��\�Tn�GF� �8%�-�� ���ᢐk�ie��g��̤5�!"�C�څ�s0N�P�{
Output for 5.5.26
Warning: mcrypt_decrypt(): The IV parameter must be as long as the blocksize in /in/cnPWI on line 39 Original string : Some text to be encrypted<br /> Encrypted string : �'+�12� 0i� Lvx���[+����S�@pp`�>s &!nɠ��Mu]g�<br /> Decrypted string1 : -ǀ|E�{��P��\�Tn�GF� �8%�-�� ���ᢐk�ie��g��̤5�!"�C�څ�s0N�P�{
Output for 5.5.25
Warning: mcrypt_decrypt(): The IV parameter must be as long as the blocksize in /in/cnPWI on line 39 Original string : Some text to be encrypted<br /> Encrypted string : _U�f� ����lX��h��O&!���f2����Rq���o�ߚN��<br /> Decrypted string1 : -ǀ|E�{��P��\�Tn�GF� �8%�-�� ���ᢐk�ie��g��̤5�!"�C�څ�s0N�P�{
Output for 5.5.24
Warning: mcrypt_decrypt(): The IV parameter must be as long as the blocksize in /in/cnPWI on line 39 Original string : Some text to be encrypted<br /> Encrypted string : �T,���o��UtJ�d6��v��%$ T"&]G&!��I�]~��S�<br /> Decrypted string1 : -ǀ|E�{��P��\�Tn�GF� �8%�-�� ���ᢐk�ie��g��̤5�!"�C�څ�s0N�P�{
Output for 5.5.23
Warning: mcrypt_decrypt(): The IV parameter must be as long as the blocksize in /in/cnPWI on line 39 Original string : Some text to be encrypted<br /> Encrypted string : ��֎{B�`��S���!�8�.�1�����3 �Z��ِ>���G�<br /> Decrypted string1 : -ǀ|E�{��P��\�Tn�GF� �8%�-�� ���ᢐk�ie��g��̤5�!"�C�څ�s0N�P�{
Output for 5.5.22
Warning: mcrypt_decrypt(): The IV parameter must be as long as the blocksize in /in/cnPWI on line 39 Original string : Some text to be encrypted<br /> Encrypted string : �8-r�pT�:?� �q|�7^ت��)s|��0a�Ӝ{�q sE(�1�8�<br /> Decrypted string1 : -ǀ|E�{��P��\�Tn�GF� �8%�-�� ���ᢐk�ie��g��̤5�!"�C�څ�s0N�P�{
Output for 5.5.21
Warning: mcrypt_decrypt(): The IV parameter must be as long as the blocksize in /in/cnPWI on line 39 Original string : Some text to be encrypted<br /> Encrypted string : �76�Ÿ�Zx�Z��%�^�4pN����� 1�ݓ�j�z���M�<br /> Decrypted string1 : -ǀ|E�{��P��\�Tn�GF� �8%�-�� ���ᢐk�ie��g��̤5�!"�C�څ�s0N�P�{
Output for 5.5.20
Warning: mcrypt_decrypt(): The IV parameter must be as long as the blocksize in /in/cnPWI on line 39 Original string : Some text to be encrypted<br /> Encrypted string : E�V*�;�����6�ot|6�iZՍ�#C�{��H� ��mX��<br /> Decrypted string1 : -ǀ|E�{��P��\�Tn�GF� �8%�-�� ���ᢐk�ie��g��̤5�!"�C�څ�s0N�P�{
Output for 5.5.19
Warning: mcrypt_decrypt(): The IV parameter must be as long as the blocksize in /in/cnPWI on line 39 Original string : Some text to be encrypted<br /> Encrypted string : �ї[B ĉES�4 0�� ��3�ˉTŖ�.�}%DuЙ,�-~=/<br /> Decrypted string1 : -ǀ|E�{��P��\�Tn�GF� �8%�-�� ���ᢐk�ie��g��̤5�!"�C�څ�s0N�P�{
Output for 5.5.18
Warning: mcrypt_decrypt(): The IV parameter must be as long as the blocksize in /in/cnPWI on line 39 Original string : Some text to be encrypted<br /> Encrypted string : �`�0j�!S�B��uG@�@�UY ;!(� ��I����6�˞��H]�f<br /> Decrypted string1 : -ǀ|E�{��P��\�Tn�GF� �8%�-�� ���ᢐk�ie��g��̤5�!"�C�څ�s0N�P�{
Output for 5.5.16
Warning: mcrypt_decrypt(): The IV parameter must be as long as the blocksize in /in/cnPWI on line 39 Original string : Some text to be encrypted<br /> Encrypted string : �p�Qw��q��F�K������U���+���ѥ�"^X��N2�fM0�<br /> Decrypted string1 : -ǀ|E�{��P��\�Tn�GF� �8%�-�� ���ᢐk�ie��g��̤5�!"�C�څ�s0N�P�{
Output for 5.5.15
Warning: mcrypt_decrypt(): The IV parameter must be as long as the blocksize in /in/cnPWI on line 39 Original string : Some text to be encrypted<br /> Encrypted string : \�u#�G,|a@Y��(���B��]��oB�e�܏~��e���cdJ<br /> Decrypted string1 : -ǀ|E�{��P��\�Tn�GF� �8%�-�� ���ᢐk�ie��g��̤5�!"�C�څ�s0N�P�{
Output for 5.5.14
Warning: mcrypt_decrypt(): The IV parameter must be as long as the blocksize in /in/cnPWI on line 39 Original string : Some text to be encrypted<br /> Encrypted string : f��@�Atܔ���f��@��7 O֑3v �J��D�5���m��<br /> Decrypted string1 : -ǀ|E�{��P��\�Tn�GF� �8%�-�� ���ᢐk�ie��g��̤5�!"�C�څ�s0N�P�{
Output for 5.5.13
Warning: mcrypt_decrypt(): The IV parameter must be as long as the blocksize in /in/cnPWI on line 39 Original string : Some text to be encrypted<br /> Encrypted string : �ˬ>�, I�I��8v8���t���|*R�4_b�%��A*��hO�<br /> Decrypted string1 : -ǀ|E�{��P��\�Tn�GF� �8%�-�� ���ᢐk�ie��g��̤5�!"�C�څ�s0N�P�{
Output for 5.5.12
Warning: mcrypt_decrypt(): The IV parameter must be as long as the blocksize in /in/cnPWI on line 39 Original string : Some text to be encrypted<br /> Encrypted string : n|�Sk�ِӻˉI�x%�k�!u��NC��(�X[~�� �{�;��53FM<br /> Decrypted string1 : -ǀ|E�{��P��\�Tn�GF� �8%�-�� ���ᢐk�ie��g��̤5�!"�C�څ�s0N�P�{
Output for 5.5.11
Warning: mcrypt_decrypt(): The IV parameter must be as long as the blocksize in /in/cnPWI on line 39 Original string : Some text to be encrypted<br /> Encrypted string : ��oM?�|ˎ�'����qjj`��+����{/�r���,q:�E���=<br /> Decrypted string1 : -ǀ|E�{��P��\�Tn�GF� �8%�-�� ���ᢐk�ie��g��̤5�!"�C�څ�s0N�P�{
Output for 5.5.10
Warning: mcrypt_decrypt(): The IV parameter must be as long as the blocksize in /in/cnPWI on line 39 Original string : Some text to be encrypted<br /> Encrypted string : ��?�� /dy��ɜ5>��`�w e�6m��(V�#e �e�/:o0�ӁE<br /> Decrypted string1 : -ǀ|E�{��P��\�Tn�GF� �8%�-�� ���ᢐk�ie��g��̤5�!"�C�څ�s0N�P�{
Output for 5.5.9
Warning: mcrypt_decrypt(): The IV parameter must be as long as the blocksize in /in/cnPWI on line 39 Original string : Some text to be encrypted<br /> Encrypted string : �LV;)��K�I� 7N�Y��r��dR$=6��mC(����@ѐ���7��<br /> Decrypted string1 : -ǀ|E�{��P��\�Tn�GF� �8%�-�� ���ᢐk�ie��g��̤5�!"�C�څ�s0N�P�{
Output for 5.5.8
Warning: mcrypt_decrypt(): The IV parameter must be as long as the blocksize in /in/cnPWI on line 39 Original string : Some text to be encrypted<br /> Encrypted string : ��0q�Rճ�"9}���w���ͽ��+��K�ǷC)W�&̪N!�-"h<br /> Decrypted string1 : -ǀ|E�{��P��\�Tn�GF� �8%�-�� ���ᢐk�ie��g��̤5�!"�C�څ�s0N�P�{
Output for 5.5.7
Warning: mcrypt_decrypt(): The IV parameter must be as long as the blocksize in /in/cnPWI on line 39 Original string : Some text to be encrypted<br /> Encrypted string : ��̸�b�2�)��z'�Xݬ�-�����>��Q ��D�ʧ�%:dfu�&�<br /> Decrypted string1 : -ǀ|E�{��P��\�Tn�GF� �8%�-�� ���ᢐk�ie��g��̤5�!"�C�څ�s0N�P�{
Output for 5.5.6
Warning: mcrypt_decrypt(): The IV parameter must be as long as the blocksize in /in/cnPWI on line 39 Original string : Some text to be encrypted<br /> Encrypted string : �<��է�����'E���9����Z/M��N:*�Ak� շ-<br /> Decrypted string1 : -ǀ|E�{��P��\�Tn�GF� �8%�-�� ���ᢐk�ie��g��̤5�!"�C�څ�s0N�P�{
Output for 5.5.5
Warning: mcrypt_decrypt(): The IV parameter must be as long as the blocksize in /in/cnPWI on line 39 Original string : Some text to be encrypted<br /> Encrypted string : �C�=_|��pA�v�|����`y�u�p � ��{�E?M�T"��� {_:�<br /> Decrypted string1 : -ǀ|E�{��P��\�Tn�GF� �8%�-�� ���ᢐk�ie��g��̤5�!"�C�څ�s0N�P�{
Output for 5.5.4
Warning: mcrypt_decrypt(): The IV parameter must be as long as the blocksize in /in/cnPWI on line 39 Original string : Some text to be encrypted<br /> Encrypted string : ���8�IY}�g1 `1q�������n�9m1����aK*�!�<br /> Decrypted string1 : -ǀ|E�{��P��\�Tn�GF� �8%�-�� ���ᢐk�ie��g��̤5�!"�C�څ�s0N�P�{
Output for 5.5.3
Warning: mcrypt_decrypt(): The IV parameter must be as long as the blocksize in /in/cnPWI on line 39 Original string : Some text to be encrypted<br /> Encrypted string : ��ͭ�P�?�x���x�����gdЕ$x:+7!%@��M��C��<br /> Decrypted string1 : -ǀ|E�{��P��\�Tn�GF� �8%�-�� ���ᢐk�ie��g��̤5�!"�C�څ�s0N�P�{
Output for 5.5.2
Warning: mcrypt_decrypt(): The IV parameter must be as long as the blocksize in /in/cnPWI on line 39 Original string : Some text to be encrypted<br /> Encrypted string : �QO��E>�l��yZ��eS��+�ma3��#��X��pa�$U� }���l<br /> Decrypted string1 : -ǀ|E�{��P��\�Tn�GF� �8%�-�� ���ᢐk�ie��g��̤5�!"�C�څ�s0N�P�{
Output for 5.5.1
Warning: mcrypt_decrypt(): The IV parameter must be as long as the blocksize in /in/cnPWI on line 39 Original string : Some text to be encrypted<br /> Encrypted string : EA)oԻ\5̣�+u�`����~p����Cd���0ޚϻ:L�F�E���o1<br /> Decrypted string1 : -ǀ|E�{��P��\�Tn�GF� �8%�-�� ���ᢐk�ie��g��̤5�!"�C�څ�s0N�P�{
Output for 5.5.0
Warning: mcrypt_decrypt(): The IV parameter must be as long as the blocksize in /in/cnPWI on line 39 Original string : Some text to be encrypted<br /> Encrypted string : �7��ku�O�����+�e�~�}pFj�m�l�nd%|C�V4|�T9����:<br /> Decrypted string1 : -ǀ|E�{��P��\�Tn�GF� �8%�-�� ���ᢐk�ie��g��̤5�!"�C�څ�s0N�P�{