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 ="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); $iv1 = "SinigangNaManok"; // 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, $iv1); echo "Original string : " . $string . "<br />\n"; echo "Encrypted string : " . $encrypted_string . "<br />\n"; echo "Decrypted string1 : " . $decrypted_string . "<br />\n"; ?>
based on 7W6ts
Output for 7.0.6 - 7.3.0rc4
Fatal error: Uncaught Error: Call to undefined function mcrypt_create_iv() in /in/VI9Jj:23 Stack trace: #0 {main} thrown in /in/VI9Jj 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/VI9Jj 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/VI9Jj on line 39 Original string : Some text to be encrypted<br /> Encrypted string : <br /> Decrypted string1 : <br />
Output for 5.5.35 - 5.5.38, 5.6.21 - 5.6.28
Fatal error: Call to undefined function mcrypt_create_iv() in /in/VI9Jj 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/VI9Jj on line 39 Original string : Some text to be encrypted<br /> Encrypted string : �p��0ex sgc��ܼ�e��$��OE)H?�)<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/VI9Jj on line 39 Original string : Some text to be encrypted<br /> Encrypted string : ��Z{�A�Hi����%aP���4޲ ��W���<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/VI9Jj on line 39 Original string : Some text to be encrypted<br /> Encrypted string : FJ�����OB�^�˦p��������/�S<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/VI9Jj on line 39 Original string : Some text to be encrypted<br /> Encrypted string : ����� �'� ~Ms��l�n�a��ڱ�ƈ� <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/VI9Jj on line 39 Original string : Some text to be encrypted<br /> Encrypted string : @^h�[�N��0\������/��a�B�'��<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/VI9Jj on line 39 Original string : Some text to be encrypted<br /> Encrypted string : �|aɄ�-�k��4|�!�I܈��Q�x��j�<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/VI9Jj on line 39 Original string : Some text to be encrypted<br /> Encrypted string : O8fG� G�:^� 3��.��s )�� n� <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/VI9Jj on line 39 Original string : Some text to be encrypted<br /> Encrypted string : ݞT�׳(}�5���-Y5|X�A�K�V{��~d<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/VI9Jj on line 39 Original string : Some text to be encrypted<br /> Encrypted string : �}�u*�{�uǞ���z��0�~�T�f`�<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/VI9Jj on line 39 Original string : Some text to be encrypted<br /> Encrypted string : m�#��r�O�4w���د|AH_��)�˵�P�<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/VI9Jj on line 39 Original string : Some text to be encrypted<br /> Encrypted string : ��G�(���P���,=Ҡ�R�D����������<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/VI9Jj on line 39 Original string : Some text to be encrypted<br /> Encrypted string : e��X���6�� :�"pp�\i��N�j��<�<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/VI9Jj on line 39 Original string : Some text to be encrypted<br /> Encrypted string : Lc�㓴���L_B7�2�iڠ�*\��q�q<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/VI9Jj on line 39 Original string : Some text to be encrypted<br /> Encrypted string : ��x�Á���s��� ����I�(~��6��G��<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/VI9Jj on line 39 Original string : Some text to be encrypted<br /> Encrypted string : Ӓ]��E����3�~�YvQ�t<�L���<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/VI9Jj on line 39 Original string : Some text to be encrypted<br /> Encrypted string : �-�� �(q �c,�nm9�!��쪤��&.,O<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/VI9Jj on line 39 Original string : Some text to be encrypted<br /> Encrypted string : ]�' ��Z/4j"���n��ӟ������C���8<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/VI9Jj on line 39 Original string : Some text to be encrypted<br /> Encrypted string : �$�V2--�.�*� t����zS�<3�4��<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/VI9Jj on line 39 Original string : Some text to be encrypted<br /> Encrypted string : R-v���8�P� �}_��b��9�9Y�d���<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/VI9Jj on line 39 Original string : Some text to be encrypted<br /> Encrypted string : �<��A(�ƪ/�#��ӻ�P䘕&�`e�<�<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/VI9Jj on line 39 Original string : Some text to be encrypted<br /> Encrypted string : sH#v�8 ��m @������������<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/VI9Jj on line 39 Original string : Some text to be encrypted<br /> Encrypted string : d�x#��A6�ַ@���t�����BO4��jk�<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/VI9Jj on line 39 Original string : Some text to be encrypted<br /> Encrypted string : ����F�11B_��u���H�*j�[��IS <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/VI9Jj on line 39 Original string : Some text to be encrypted<br /> Encrypted string : �Q��u'�e�&�U0�]���+b��u�F<��<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/VI9Jj on line 39 Original string : Some text to be encrypted<br /> Encrypted string : B�m����u��IT ��K��/�<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/VI9Jj on line 39 Original string : Some text to be encrypted<br /> Encrypted string : �xu�N� l3��聹?k�6�I���*�Еl<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/VI9Jj on line 39 Original string : Some text to be encrypted<br /> Encrypted string : ��u�-9���� nV�VŊ��$r�����K<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/VI9Jj on line 39 Original string : Some text to be encrypted<br /> Encrypted string : � ^���6���O����Xw����}'���<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/VI9Jj on line 39 Original string : Some text to be encrypted<br /> Encrypted string : �{�B�yU �ǃ��tm�+�}i&lShhĺ<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/VI9Jj on line 39 Original string : Some text to be encrypted<br /> Encrypted string : <�8�����QNY�X��'�Ϥ�P�� ��<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/VI9Jj on line 39 Original string : Some text to be encrypted<br /> Encrypted string : wD��˩�c(՝M���ȿ=^|’j�0w�<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/VI9Jj on line 39 Original string : Some text to be encrypted<br /> Encrypted string : 6�̍�aD�b�2��9��5�=��`���V><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/VI9Jj on line 39 Original string : Some text to be encrypted<br /> Encrypted string : &� IIN�t�Hh� /���8%�㯩�TԌ�<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/VI9Jj on line 39 Original string : Some text to be encrypted<br /> Encrypted string : ѺS�Ƌ���{����-��[8d��c;�<br /> Decrypted string1 : ����o�����^�+����<br />