3v4l.org

run code in 150+ 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"; // 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_256, $secret_key, $encrypted_string, MCRYPT_MODE_CBC, $iv); echo "Original string : " . $string . "<br />\n"; echo "Encrypted string : " . $encrypted_string . "<br />\n"; echo "Decrypted string : " . $decrypted_string . "<br />\n"; ?>
Output for 7.0.6 - 7.1.0
Fatal error: Uncaught Error: Call to undefined function mcrypt_create_iv() in /in/caCEc:9 Stack trace: #0 {main} thrown in /in/caCEc on line 9
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/caCEc on line 12 Warning: mcrypt_decrypt(): Key of size 21 not supported by this algorithm. Only keys of sizes 16, 24 or 32 supported in /in/caCEc on line 15 Original string : Some text to be encrypted<br /> Encrypted string : <br /> Decrypted string : <br />
Output for hhvm-3.12.0
Original string : Some text to be encrypted<br /> Encrypted string : .�zy���j�U��W( �����C �����<br /> Decrypted string : Some text to be encrypted<br />
Output for hhvm-3.10.0
Original string : Some text to be encrypted<br /> Encrypted string : �l������^��޻p�b��~��D�Sc�7��<br /> Decrypted string : Some text to be encrypted<br />
Output for 5.0.0 - 5.3.29, 5.5.35 - 5.5.36, 5.6.21 - 5.6.28
Fatal error: Call to undefined function mcrypt_create_iv() in /in/caCEc on line 9
Process exited with code 255.
Output for 5.5.34
Original string : Some text to be encrypted<br /> Encrypted string : h�A����3 �&�M�.ܦ^��K��K<br /> Decrypted string : Some text to be encrypted<br />
Output for 5.5.33
Original string : Some text to be encrypted<br /> Encrypted string : U!\��pKׅ����.qQ�3�'g��ܫ�7H<br /> Decrypted string : Some text to be encrypted<br />
Output for 5.5.32
Original string : Some text to be encrypted<br /> Encrypted string : ք�?1Z�I�U�K��$��V�*�Y*�P�`zNY<br /> Decrypted string : Some text to be encrypted<br />
Output for 5.5.31
Original string : Some text to be encrypted<br /> Encrypted string : � r[��*��9���4��A��ٓ�c ]�<br /> Decrypted string : Some text to be encrypted<br />
Output for 5.5.30
Original string : Some text to be encrypted<br /> Encrypted string : �l�OM�w�6"����5>��_dbaA���h�><br /> Decrypted string : Some text to be encrypted<br />
Output for 5.5.29
Original string : Some text to be encrypted<br /> Encrypted string : �9�%y�#�<�Y�%kK��>��6m�Ҫŭ{<br /> Decrypted string : Some text to be encrypted<br />
Output for 5.5.28
Original string : Some text to be encrypted<br /> Encrypted string : l��w��1NO���SF�x�2#����vJ53��m�<br /> Decrypted string : Some text to be encrypted<br />
Output for 5.5.27
Original string : Some text to be encrypted<br /> Encrypted string : 5�lE�cb0{Rl�L����)���ׇ�ڹ�<br /> Decrypted string : Some text to be encrypted<br />
Output for 5.5.26
Original string : Some text to be encrypted<br /> Encrypted string : OciR�p���{���� �,�3Yڡm����<br /> Decrypted string : Some text to be encrypted<br />
Output for 5.5.25
Original string : Some text to be encrypted<br /> Encrypted string : U�S=�7��FO��0��TK���:�32�|g0�<br /> Decrypted string : Some text to be encrypted<br />
Output for 5.5.24
Original string : Some text to be encrypted<br /> Encrypted string : �ɟ��K���%�+��ÿHR������h�k#<br /> Decrypted string : Some text to be encrypted<br />
Output for 5.5.23
Original string : Some text to be encrypted<br /> Encrypted string : r��C20��Ld\=�>���ؗV���M DGY*�<br /> Decrypted string : Some text to be encrypted<br />
Output for 5.5.22
Original string : Some text to be encrypted<br /> Encrypted string : _C��t�}�'�{:����nx�������?�P�<br /> Decrypted string : Some text to be encrypted<br />
Output for 5.5.21
Original string : Some text to be encrypted<br /> Encrypted string : �j�u0��<K����͜rf����_0<br /> Decrypted string : Some text to be encrypted<br />
Output for 5.5.20
Original string : Some text to be encrypted<br /> Encrypted string : S_�����H��~�x����5�ʀ)�'<br /> Decrypted string : Some text to be encrypted<br />
Output for 5.5.19
Original string : Some text to be encrypted<br /> Encrypted string : ߖJn�+�r��@,K 4��tY��_?j�v�.�<br /> Decrypted string : Some text to be encrypted<br />
Output for 5.5.18
Original string : Some text to be encrypted<br /> Encrypted string : �'���&&o.R����%�#�L�qA���gg<br /> Decrypted string : Some text to be encrypted<br />
Output for 5.5.16
Original string : Some text to be encrypted<br /> Encrypted string : ـw�p�0���iS�>����>� �ut�*�1�<br /> Decrypted string : Some text to be encrypted<br />
Output for 5.5.15
Original string : Some text to be encrypted<br /> Encrypted string : P� �&Sd�����$���n1�~ ~1W!<br /> Decrypted string : Some text to be encrypted<br />
Output for 5.5.14
Original string : Some text to be encrypted<br /> Encrypted string : /�BM�LK�J(Zq�]ee;y��bV�x��<br /> Decrypted string : Some text to be encrypted<br />
Output for 5.5.13
Original string : Some text to be encrypted<br /> Encrypted string : �lDs�‹�� ��f�� H�~՝�lm����21<br /> Decrypted string : Some text to be encrypted<br />
Output for 5.5.12
Original string : Some text to be encrypted<br /> Encrypted string : z1/CO=F"�W�̯�t�>�V �>6G��u^�<br /> Decrypted string : Some text to be encrypted<br />
Output for 5.5.11
Original string : Some text to be encrypted<br /> Encrypted string : D+$����_p+� J5��l)�"QZp��H� <br /> Decrypted string : Some text to be encrypted<br />
Output for 5.5.10
Original string : Some text to be encrypted<br /> Encrypted string : CJ� ���V�l�bZ,��Q{R��W���s��,<br /> Decrypted string : Some text to be encrypted<br />
Output for 5.5.9
Original string : Some text to be encrypted<br /> Encrypted string : �F����͞U�Ȼ�jp�OT:w5��?�0��<br /> Decrypted string : Some text to be encrypted<br />
Output for 5.5.8
Original string : Some text to be encrypted<br /> Encrypted string : ��}���4�K�oty|f����C-?C���zu<br /> Decrypted string : Some text to be encrypted<br />
Output for 5.5.7
Original string : Some text to be encrypted<br /> Encrypted string : _z۪L �>��&�BYQ*'��y��`l�n�czs<br /> Decrypted string : Some text to be encrypted<br />
Output for 5.5.6
Original string : Some text to be encrypted<br /> Encrypted string : إ����g sʏ\oܣ�^5� 6��&V<br /> Decrypted string : Some text to be encrypted<br />
Output for 5.5.5
Original string : Some text to be encrypted<br /> Encrypted string : ���e�czf�儧vAb�v��OZ~��L��&�<br /> Decrypted string : Some text to be encrypted<br />
Output for 5.5.4
Original string : Some text to be encrypted<br /> Encrypted string : 3�h���n�Q�q����̀��]=�|F{WMP�J<br /> Decrypted string : Some text to be encrypted<br />
Output for 5.5.3
Original string : Some text to be encrypted<br /> Encrypted string : �����|U�9�Ba`�r�<;�""��+�B<br /> Decrypted string : Some text to be encrypted<br />
Output for 5.5.2
Original string : Some text to be encrypted<br /> Encrypted string : �2+�^5�!�;�,��s��d39���ڔH<br /> Decrypted string : Some text to be encrypted<br />
Output for 5.5.1
Original string : Some text to be encrypted<br /> Encrypted string : ��i����ٰ%�%<��O������f'�Y<br /> Decrypted string : Some text to be encrypted<br />
Output for 5.5.0
Original string : Some text to be encrypted<br /> Encrypted string : ��,��n�4/n�G���&0���rҋU<br /> Decrypted string : Some text to be encrypted<br />
Output for 5.4.45
Original string : Some text to be encrypted<br /> Encrypted string : ��*QJ])00�Uw���^<{Zݯ�ggD�(<br /> Decrypted string : Some text to be encrypted<br />
Output for 5.4.44
Original string : Some text to be encrypted<br /> Encrypted string : ��?�����Ϻ����y �r�b�lpk� �5<br /> Decrypted string : Some text to be encrypted<br />
Output for 5.4.43
Original string : Some text to be encrypted<br /> Encrypted string : �d���ܸG���k9�D�nl�XE�^�+���$p<br /> Decrypted string : Some text to be encrypted<br />
Output for 5.4.42
Original string : Some text to be encrypted<br /> Encrypted string : o�٪�x���� ��7Su��%݊�HH��<br /> Decrypted string : Some text to be encrypted<br />
Output for 5.4.41
Original string : Some text to be encrypted<br /> Encrypted string : �1����D@<pp7��G�P�y�zGo3$��y�<br /> Decrypted string : Some text to be encrypted<br />
Output for 5.4.40
Original string : Some text to be encrypted<br /> Encrypted string : �F`�e����n/�z��|7�U��I�Qt;)�<br /> Decrypted string : Some text to be encrypted<br />
Output for 5.4.39
Original string : Some text to be encrypted<br /> Encrypted string : �(�2� �G̐,T�!c0_VL��"�"~<br /> Decrypted string : Some text to be encrypted<br />
Output for 5.4.38
Original string : Some text to be encrypted<br /> Encrypted string : �����ND�W�pgO� �ò]Pl�z"Q��<br /> Decrypted string : Some text to be encrypted<br />
Output for 5.4.37
Original string : Some text to be encrypted<br /> Encrypted string : ��_d�6����])\`L��:]#CjTN&j<br /> Decrypted string : Some text to be encrypted<br />
Output for 5.4.36
Original string : Some text to be encrypted<br /> Encrypted string : ���� ����-,�l��YdǾ�� 1��'!�<br /> Decrypted string : Some text to be encrypted<br />
Output for 5.4.35
Original string : Some text to be encrypted<br /> Encrypted string : sTs��\SR��abȢ�d�ׂr+sz�rE�*t<br /> Decrypted string : Some text to be encrypted<br />
Output for 5.4.34
Original string : Some text to be encrypted<br /> Encrypted string : � �_ �6�Zգ�(m�0`�;(�_l�|���<br /> Decrypted string : Some text to be encrypted<br />
Output for 5.4.32
Original string : Some text to be encrypted<br /> Encrypted string : ���4&��1.��I��<�P` � &G���7<br /> Decrypted string : Some text to be encrypted<br />
Output for 5.4.31
Original string : Some text to be encrypted<br /> Encrypted string : O72��/��Q]�F�B�l�ȇ<�h FV�<br /> Decrypted string : Some text to be encrypted<br />
Output for 5.4.30
Original string : Some text to be encrypted<br /> Encrypted string : �H��]H{����5'�s�6B0�u�"��<br /> Decrypted string : Some text to be encrypted<br />
Output for 5.4.29
Original string : Some text to be encrypted<br /> Encrypted string : �����֭��Y��!��?L�ٙ��\%���<br /> Decrypted string : Some text to be encrypted<br />
Output for 5.4.28
Original string : Some text to be encrypted<br /> Encrypted string : >�A�*�y?l��9q�iv�oK �=�}~�O��<br /> Decrypted string : Some text to be encrypted<br />
Output for 5.4.27
Original string : Some text to be encrypted<br /> Encrypted string : #��n��F��P�J4�.� 3U$�[�P<��<br /> Decrypted string : Some text to be encrypted<br />
Output for 5.4.26
Original string : Some text to be encrypted<br /> Encrypted string : ��/R6 ��GW��d�����xy���^�A<br /> Decrypted string : Some text to be encrypted<br />
Output for 5.4.25
Original string : Some text to be encrypted<br /> Encrypted string : ��l5$�����졵O�-�S�o;pfd@�<br /> Decrypted string : Some text to be encrypted<br />
Output for 5.4.24
Original string : Some text to be encrypted<br /> Encrypted string : �e�zn���;z��,GH���!ib�i3�T<br /> Decrypted string : Some text to be encrypted<br />
Output for 5.4.23
Original string : Some text to be encrypted<br /> Encrypted string : D$M��v; m���4l,�q�:�撖if=nh<br /> Decrypted string : Some text to be encrypted<br />
Output for 5.4.22
Original string : Some text to be encrypted<br /> Encrypted string : $�zͺ_��0�]}<��xQ�#��l4TyPțB�<br /> Decrypted string : Some text to be encrypted<br />
Output for 5.4.21
Original string : Some text to be encrypted<br /> Encrypted string : ����=�W��5U�l +� ����E�i�{�o_!<br /> Decrypted string : Some text to be encrypted<br />
Output for 5.4.20
Original string : Some text to be encrypted<br /> Encrypted string : �!v8� X�-? �i�P[���gM�_�̹<br /> Decrypted string : Some text to be encrypted<br />
Output for 5.4.19
Original string : Some text to be encrypted<br /> Encrypted string : {��\�TL�m,��UE89�г�$�Uz� K<br /> Decrypted string : Some text to be encrypted<br />
Output for 5.4.18
Original string : Some text to be encrypted<br /> Encrypted string : ��� ��A,� 8>�a�ZH[<^M�y�st<br /> Decrypted string : Some text to be encrypted<br />
Output for 5.4.17
Original string : Some text to be encrypted<br /> Encrypted string : �:Ri�ޡN���}�O�H�VKB������<br /> Decrypted string : Some text to be encrypted<br />
Output for 5.4.16
Original string : Some text to be encrypted<br /> Encrypted string : �=�ԭ�Aa m���s�C�B��K���<br /> Decrypted string : Some text to be encrypted<br />
Output for 5.4.15
Original string : Some text to be encrypted<br /> Encrypted string : SzQ�.c���t$�6������WU��`�t� �/<br /> Decrypted string : Some text to be encrypted<br />
Output for 5.4.14
Original string : Some text to be encrypted<br /> Encrypted string : dy���ŝ��� K�p50�w#Nݝ�y��T<br /> Decrypted string : Some text to be encrypted<br />
Output for 5.4.13
Original string : Some text to be encrypted<br /> Encrypted string : ��=a��g�H m �%�*2to.d]/|�<br /> Decrypted string : Some text to be encrypted<br />
Output for 5.4.12
Original string : Some text to be encrypted<br /> Encrypted string : �Xӏ���^�1-����܆�� �CB���{�<br /> Decrypted string : Some text to be encrypted<br />
Output for 5.4.11
Original string : Some text to be encrypted<br /> Encrypted string : �zng�����CW$z�2C_���#]� 7�d�3"<br /> Decrypted string : Some text to be encrypted<br />
Output for 5.4.10
Original string : Some text to be encrypted<br /> Encrypted string : �Ckc�E�-�Ubҏ��i���q{c����<br /> Decrypted string : Some text to be encrypted<br />
Output for 5.4.9
Original string : Some text to be encrypted<br /> Encrypted string : A���"����� cp�'<�Z��b�%�G�<t<br /> Decrypted string : Some text to be encrypted<br />
Output for 5.4.8
Original string : Some text to be encrypted<br /> Encrypted string : �sUR�ǹ�2��?/�c�i�P�w.B��[=C��<br /> Decrypted string : Some text to be encrypted<br />
Output for 5.4.7
Original string : Some text to be encrypted<br /> Encrypted string : ��Ғ��~����*�T"F�D}a/�"�nMѓ<br /> Decrypted string : Some text to be encrypted<br />
Output for 5.4.6
Original string : Some text to be encrypted<br /> Encrypted string : M�$��^xj���\��ΐ>d��qllkj�5<br /> Decrypted string : Some text to be encrypted<br />
Output for 5.4.5
Original string : Some text to be encrypted<br /> Encrypted string : �����g�/�&��I�#�&ظd#+�?&�UA<br /> Decrypted string : Some text to be encrypted<br />
Output for 5.4.4
Original string : Some text to be encrypted<br /> Encrypted string : �y-���C��>̇2�2�� ���΁�:o<br /> Decrypted string : Some text to be encrypted<br />
Output for 5.4.3
Original string : Some text to be encrypted<br /> Encrypted string : ?�y�J� j7Mi�_���p�@՘���U�*<br /> Decrypted string : Some text to be encrypted<br />
Output for 5.4.2
Original string : Some text to be encrypted<br /> Encrypted string : ��-lF�>����Y�c�":�4M���4�<br /> Decrypted string : Some text to be encrypted<br />
Output for 5.4.1
Original string : Some text to be encrypted<br /> Encrypted string : ��,������^cw�� .��^n�;S( �6<br /> Decrypted string : Some text to be encrypted<br />
Output for 5.4.0
Original string : Some text to be encrypted<br /> Encrypted string : �\����%�����6ɞ@ �X�N�RAm<br /> Decrypted string : Some text to be encrypted<br />
Output for 4.4.5 - 4.4.9
Fatal error: Call to undefined function: mcrypt_create_iv() in /in/caCEc on line 9
Process exited with code 255.
Output for 4.3.2 - 4.4.4
Fatal error: Call to undefined function: mcrypt_create_iv() in /in/caCEc on line 9
Process exited with code 255.
Output for 4.3.0 - 4.3.1
Fatal error: Call to undefined function: mcrypt_create_iv() in /in/caCEc on line 9