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 cnPWI
Output for 7.0.6 - 7.3.0rc4
Fatal error: Uncaught Error: Call to undefined function mcrypt_create_iv() in /in/VtkAY:23 Stack trace: #0 {main} thrown in /in/VtkAY 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/VtkAY 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/VtkAY 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/VtkAY 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/VtkAY on line 39 Original string : Some text to be encrypted<br /> Encrypted string : [��cn\ȼ�m噧�d��4�ڷʼ)AN�O�BjyLB�U��=<br /> Decrypted string1 : >��@�����導��I,�;[�u��)�n d~��:� |��p��+�anJwI=X.�S��ĉIP�V�k��
Output for 5.5.33
Warning: mcrypt_decrypt(): The IV parameter must be as long as the blocksize in /in/VtkAY on line 39 Original string : Some text to be encrypted<br /> Encrypted string : ��w\�~P�-��Q�2,�ls1l�]���faƦ hh�_�[ϵʅ�<br /> Decrypted string1 : >��@�����導��I,�;[�u��)�n d~��:� |��p��+�anJwI=X.�S��ĉIP�V�k��
Output for 5.5.32
Warning: mcrypt_decrypt(): The IV parameter must be as long as the blocksize in /in/VtkAY on line 39 Original string : Some text to be encrypted<br /> Encrypted string : x6��W :�cK�pR9NH.�<�S7��"�q/� ��e�`�`�h�<br /> Decrypted string1 : >��@�����導��I,�;[�u��)�n d~��:� |��p��+�anJwI=X.�S��ĉIP�V�k��
Output for 5.5.31
Warning: mcrypt_decrypt(): The IV parameter must be as long as the blocksize in /in/VtkAY on line 39 Original string : Some text to be encrypted<br /> Encrypted string : d�^$ 4R����/�W\�@�f���a�h��pZ��3MKĿ0�������<br /> Decrypted string1 : >��@�����導��I,�;[�u��)�n d~��:� |��p��+�anJwI=X.�S��ĉIP�V�k��
Output for 5.5.30
Warning: mcrypt_decrypt(): The IV parameter must be as long as the blocksize in /in/VtkAY on line 39 Original string : Some text to be encrypted<br /> Encrypted string : ܚ��W=m4C}D/Ɨg��DŽ��px�*�|W�~����Π���]<br /> Decrypted string1 : >��@�����導��I,�;[�u��)�n d~��:� |��p��+�anJwI=X.�S��ĉIP�V�k��
Output for 5.5.29
Warning: mcrypt_decrypt(): The IV parameter must be as long as the blocksize in /in/VtkAY on line 39 Original string : Some text to be encrypted<br /> Encrypted string : �&����k�Gѻ��]��`�dA�ϲ�?�o~w7���N:՛<br /> Decrypted string1 : >��@�����導��I,�;[�u��)�n d~��:� |��p��+�anJwI=X.�S��ĉIP�V�k��
Output for 5.5.28
Warning: mcrypt_decrypt(): The IV parameter must be as long as the blocksize in /in/VtkAY on line 39 Original string : Some text to be encrypted<br /> Encrypted string : |ހE���W��|<U�1�F�tD�h� we��R��uE&<br /> Decrypted string1 : >��@�����導��I,�;[�u��)�n d~��:� |��p��+�anJwI=X.�S��ĉIP�V�k��
Output for 5.5.27
Warning: mcrypt_decrypt(): The IV parameter must be as long as the blocksize in /in/VtkAY on line 39 Original string : Some text to be encrypted<br /> Encrypted string : �i����[���c񲏀 7�r�.��q��g���A�щ�ԃ��<br /> Decrypted string1 : >��@�����導��I,�;[�u��)�n d~��:� |��p��+�anJwI=X.�S��ĉIP�V�k��
Output for 5.5.26
Warning: mcrypt_decrypt(): The IV parameter must be as long as the blocksize in /in/VtkAY on line 39 Original string : Some text to be encrypted<br /> Encrypted string : �[�K�qoEGE�-��1� CF�1x#�����\,��r���)�܉}<br /> Decrypted string1 : >��@�����導��I,�;[�u��)�n d~��:� |��p��+�anJwI=X.�S��ĉIP�V�k��
Output for 5.5.25
Warning: mcrypt_decrypt(): The IV parameter must be as long as the blocksize in /in/VtkAY on line 39 Original string : Some text to be encrypted<br /> Encrypted string : ��fwgʨ��ӭ�wT4�%��(%c�I�g����f�7�w�,fS9�T<br /> Decrypted string1 : >��@�����導��I,�;[�u��)�n d~��:� |��p��+�anJwI=X.�S��ĉIP�V�k��
Output for 5.5.24
Warning: mcrypt_decrypt(): The IV parameter must be as long as the blocksize in /in/VtkAY on line 39 Original string : Some text to be encrypted<br /> Encrypted string : \�frxI�m��JcK`Q{�p#��9�H� ��[W�+��Eá��<br /> Decrypted string1 : >��@�����導��I,�;[�u��)�n d~��:� |��p��+�anJwI=X.�S��ĉIP�V�k��
Output for 5.5.23
Warning: mcrypt_decrypt(): The IV parameter must be as long as the blocksize in /in/VtkAY on line 39 Original string : Some text to be encrypted<br /> Encrypted string : �>w���%uh��:�&s��2{g��ʪ��A��������m<br /> Decrypted string1 : >��@�����導��I,�;[�u��)�n d~��:� |��p��+�anJwI=X.�S��ĉIP�V�k��
Output for 5.5.22
Warning: mcrypt_decrypt(): The IV parameter must be as long as the blocksize in /in/VtkAY on line 39 Original string : Some text to be encrypted<br /> Encrypted string : �Yl��e��ѕ��W3��S[ ��w���vB�\M�� ë�zLoN<br /> Decrypted string1 : >��@�����導��I,�;[�u��)�n d~��:� |��p��+�anJwI=X.�S��ĉIP�V�k��
Output for 5.5.21
Warning: mcrypt_decrypt(): The IV parameter must be as long as the blocksize in /in/VtkAY on line 39 Original string : Some text to be encrypted<br /> Encrypted string : i�ւ�7����T����6��4�SxVbg�IDtp����L"T��<br /> Decrypted string1 : >��@�����導��I,�;[�u��)�n d~��:� |��p��+�anJwI=X.�S��ĉIP�V�k��
Output for 5.5.20
Warning: mcrypt_decrypt(): The IV parameter must be as long as the blocksize in /in/VtkAY on line 39 Original string : Some text to be encrypted<br /> Encrypted string : ��hx�KLh�n��B ޑ��$ � D�dA��g�k�Ή�+��g<br /> Decrypted string1 : >��@�����導��I,�;[�u��)�n d~��:� |��p��+�anJwI=X.�S��ĉIP�V�k��
Output for 5.5.19
Warning: mcrypt_decrypt(): The IV parameter must be as long as the blocksize in /in/VtkAY on line 39 Original string : Some text to be encrypted<br /> Encrypted string : ҟ9�P���h�"�Nm�$��+�4J'�-���F�ٻ . ��|rY��L}�<br /> Decrypted string1 : >��@�����導��I,�;[�u��)�n d~��:� |��p��+�anJwI=X.�S��ĉIP�V�k��
Output for 5.5.18
Warning: mcrypt_decrypt(): The IV parameter must be as long as the blocksize in /in/VtkAY on line 39 Original string : Some text to be encrypted<br /> Encrypted string : s��w�g���dv�&H�H���@�G%YP%n��8�&9�v��Sy���<br /> Decrypted string1 : >��@�����導��I,�;[�u��)�n d~��:� |��p��+�anJwI=X.�S��ĉIP�V�k��
Output for 5.5.16
Warning: mcrypt_decrypt(): The IV parameter must be as long as the blocksize in /in/VtkAY on line 39 Original string : Some text to be encrypted<br /> Encrypted string : D�z,p�a�L��s87���>59��W��}��i��V� ��a�H1<br /> Decrypted string1 : >��@�����導��I,�;[�u��)�n d~��:� |��p��+�anJwI=X.�S��ĉIP�V�k��
Output for 5.5.15
Warning: mcrypt_decrypt(): The IV parameter must be as long as the blocksize in /in/VtkAY on line 39 Original string : Some text to be encrypted<br /> Encrypted string : ����$�� �оW(.-�=���䦄�dW��,����Z� 7���W�k|R<br /> Decrypted string1 : >��@�����導��I,�;[�u��)�n d~��:� |��p��+�anJwI=X.�S��ĉIP�V�k��
Output for 5.5.14
Warning: mcrypt_decrypt(): The IV parameter must be as long as the blocksize in /in/VtkAY on line 39 Original string : Some text to be encrypted<br /> Encrypted string : `��c�H�U� �6����#�F���*0���C��H�t;AG 5O�<br /> Decrypted string1 : >��@�����導��I,�;[�u��)�n d~��:� |��p��+�anJwI=X.�S��ĉIP�V�k��
Output for 5.5.13
Warning: mcrypt_decrypt(): The IV parameter must be as long as the blocksize in /in/VtkAY on line 39 Original string : Some text to be encrypted<br /> Encrypted string : ���=�v�є�j��0�/��y��:�����+c��r���]d����<br /> Decrypted string1 : >��@�����導��I,�;[�u��)�n d~��:� |��p��+�anJwI=X.�S��ĉIP�V�k��
Output for 5.5.12
Warning: mcrypt_decrypt(): The IV parameter must be as long as the blocksize in /in/VtkAY on line 39 Original string : Some text to be encrypted<br /> Encrypted string : ]��ia!����_ҭ>;(s��-\���9=Ȉ�[gL��xXs2=��<br /> Decrypted string1 : >��@�����導��I,�;[�u��)�n d~��:� |��p��+�anJwI=X.�S��ĉIP�V�k��
Output for 5.5.11
Warning: mcrypt_decrypt(): The IV parameter must be as long as the blocksize in /in/VtkAY on line 39 Original string : Some text to be encrypted<br /> Encrypted string : ul_�G!e3�W�n���V��Gp>;�w�Ms:x�����˚[}y)<br /> Decrypted string1 : >��@�����導��I,�;[�u��)�n d~��:� |��p��+�anJwI=X.�S��ĉIP�V�k��
Output for 5.5.10
Warning: mcrypt_decrypt(): The IV parameter must be as long as the blocksize in /in/VtkAY on line 39 Original string : Some text to be encrypted<br /> Encrypted string : �9�"5+�\:Ԉ��k��#7SS�_7U}��ht�IJ�}�����&<br /> Decrypted string1 : >��@�����導��I,�;[�u��)�n d~��:� |��p��+�anJwI=X.�S��ĉIP�V�k��
Output for 5.5.9
Warning: mcrypt_decrypt(): The IV parameter must be as long as the blocksize in /in/VtkAY on line 39 Original string : Some text to be encrypted<br /> Encrypted string : �V;���f4nI����,��p\�D�4��r�����p?�1��F�<br /> Decrypted string1 : >��@�����導��I,�;[�u��)�n d~��:� |��p��+�anJwI=X.�S��ĉIP�V�k��
Output for 5.5.8
Warning: mcrypt_decrypt(): The IV parameter must be as long as the blocksize in /in/VtkAY on line 39 Original string : Some text to be encrypted<br /> Encrypted string : +e��� һ5��5Py�>���_����x~�70�C�� �Ѭ<br /> Decrypted string1 : >��@�����導��I,�;[�u��)�n d~��:� |��p��+�anJwI=X.�S��ĉIP�V�k��
Output for 5.5.7
Warning: mcrypt_decrypt(): The IV parameter must be as long as the blocksize in /in/VtkAY on line 39 Original string : Some text to be encrypted<br /> Encrypted string : ���f��*�a2��<��Y����ԣ]K[r�w �[S��6���!�<br /> Decrypted string1 : >��@�����導��I,�;[�u��)�n d~��:� |��p��+�anJwI=X.�S��ĉIP�V�k��
Output for 5.5.6
Warning: mcrypt_decrypt(): The IV parameter must be as long as the blocksize in /in/VtkAY on line 39 Original string : Some text to be encrypted<br /> Encrypted string : l9y��7ٷ{��,\���� ~F�)�Dž�b3���,t��K�ߪ~K�<br /> Decrypted string1 : >��@�����導��I,�;[�u��)�n d~��:� |��p��+�anJwI=X.�S��ĉIP�V�k��
Output for 5.5.5
Warning: mcrypt_decrypt(): The IV parameter must be as long as the blocksize in /in/VtkAY on line 39 Original string : Some text to be encrypted<br /> Encrypted string : ��;��m�fv~� q�%خ#�)1�EGS� mN�Ke+M�G2<br /> Decrypted string1 : >��@�����導��I,�;[�u��)�n d~��:� |��p��+�anJwI=X.�S��ĉIP�V�k��
Output for 5.5.4
Warning: mcrypt_decrypt(): The IV parameter must be as long as the blocksize in /in/VtkAY on line 39 Original string : Some text to be encrypted<br /> Encrypted string : ��pAk�(Ć�[��f�6g�B���ֶ�B�\;x�̓#�6Uz:�<br /> Decrypted string1 : >��@�����導��I,�;[�u��)�n d~��:� |��p��+�anJwI=X.�S��ĉIP�V�k��
Output for 5.5.3
Warning: mcrypt_decrypt(): The IV parameter must be as long as the blocksize in /in/VtkAY on line 39 Original string : Some text to be encrypted<br /> Encrypted string : �D�wa��?���g0~�˂���`��^3G9I�Y�*ڣ�Ҕ��l�<br /> Decrypted string1 : >��@�����導��I,�;[�u��)�n d~��:� |��p��+�anJwI=X.�S��ĉIP�V�k��
Output for 5.5.2
Warning: mcrypt_decrypt(): The IV parameter must be as long as the blocksize in /in/VtkAY on line 39 Original string : Some text to be encrypted<br /> Encrypted string : ����[)Bd���t�� ���s�� F����^U�}�MQ�^��{/[pS<br /> Decrypted string1 : >��@�����導��I,�;[�u��)�n d~��:� |��p��+�anJwI=X.�S��ĉIP�V�k��
Output for 5.5.1
Warning: mcrypt_decrypt(): The IV parameter must be as long as the blocksize in /in/VtkAY on line 39 Original string : Some text to be encrypted<br /> Encrypted string : Zڬ=��>�� ��� P�N0uT6+Iu� �2�ǀ���0?znZsQ<br /> Decrypted string1 : >��@�����導��I,�;[�u��)�n d~��:� |��p��+�anJwI=X.�S��ĉIP�V�k��
Output for 5.5.0
Warning: mcrypt_decrypt(): The IV parameter must be as long as the blocksize in /in/VtkAY on line 39 Original string : Some text to be encrypted<br /> Encrypted string : �!lTY��߭Tv�ŜɌ���Qy.�L�d l.�`��'��Ddߣ4��<br /> Decrypted string1 : >��@�����導��I,�;[�u��)�n d~��:� |��p��+�anJwI=X.�S��ĉIP�V�k��