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create_iv( mcrypt_get_iv_size(MCRYPT_RIJNDAEL_128, MCRYPT_MODE_CBC), MCRYPT_DEV_URANDOM ); $encrypted = $string; $data = base64_decode($string); $iv = substr($data, 0, mcrypt_get_iv_size(MCRYPT_RIJNDAEL_128, MCRYPT_MODE_CBC)); $decrypted = rtrim( mcrypt_decrypt( MCRYPT_RIJNDAEL_128, hash('base64', $key, true), substr($data, mcrypt_get_iv_size(MCRYPT_RIJNDAEL_128, MCRYPT_MODE_CBC)), MCRYPT_MODE_CBC, $iv ), "\0" ); echo 'Encrypted:' . "\n"; var_dump($encrypted); echo "\n"; echo 'Decrypted:' . "\n"; var_dump($decrypted);
based on X6k3n
Output for 7.0.6 - 7.2.0
Fatal error: Uncaught Error: Call to undefined function mcrypt_create_iv() in /in/hSF3C:8 Stack trace: #0 {main} thrown in /in/hSF3C on line 8
Process exited with code 255.
Output for 7.0.0 - 7.0.5
Warning: hash(): Unknown hashing algorithm: base64 in /in/hSF3C on line 22 Warning: mcrypt_decrypt(): Key of size 0 not supported by this algorithm. Only keys of sizes 16, 24 or 32 supported in /in/hSF3C on line 24 Encrypted: string(974) " RW81TzczRElWOVROZE9MWE1JVmtSWmk3MjRBZW5NdWdWZnhYU29DWEttMVN0VUhmCi1fY3dxWVJJNHNkbXQwVXNHLWoyOVV3OFU1MG1yWnpyR3RXcG8taWF3cUFTVWxyZQpWUFRiTFVUc0hKR0NaNWNFbWx4UXZaRGYzb2xOa2Nibm81Mk9wN2VDRDE3T0hHbE8KZWU1bjhmSXkyUmRfSTI3YWp0NXoxXzJOdjl6N2ZoazZQaHZVQzVkRzY4UklONkVOCnlsTDdRTmlDMlJqRndTUU5Icm1YUmstX09tZzhmN1J1bTdfbzQ0c1pJQkVLOFJWagp4MjdqcXdGSWY1am1kdE5NMXdhRXIzMDJPTENMbXF5endwbFN6cWc4WmFmazRrS0MKaEFNTjJURnZINjBzR0lZSmpTdTJmcDJ6Mnp5WEl4Z2toSV9VWjRwOXloUjdNTFZwClV4SEk2ZC1fRzg4eUphU2FhbGlYS194TFVhYVZ6RFl0S2ZEckNzNkF6dGprLS01UQp2SHJ4R2p6dFZiUHN6OUpyMW9kdGxPc2g1cHVOS0s2YkptOEZFSlJKNFVzZW51U2sKZnFkV0d5ekdPQjA4dXg2R2JIWmlPZkRHUjdRNzYtdnJLOEtmaG9ILVowd3BoRV9zClNEZnIzMW0wMk55TFFCbWdiQTVrOEduOHlIVXlya3NtY2xWSWNtVVFZdXhObkdYbwpRaU56d2tVV0NJVjJZZHR2NjlWeU5GVWctOFZBYk9HNWFxaVJvUGxQZ3IycVlBNG4Kc0JfQWFjd2pkMFV5LWxYRThFZW9BSXhYMFBTbldQUVNwcllyTTRaQ0xvUjRwY3puCm5PakFuclNTZ2UyNWE1bzRweTdUekNVYW5kMlZKNE5Jei1rdnI1Qmp6OW9UZlc3UApwVHZDOGg0cHV0SW1NQWFmLUc5X2xzM1JzSlcwYndXUkVpSnNTT1dSeGQ0 " Decrypted: string(0) ""
Output for 5.3.19 - 5.3.29, 5.5.35, 5.6.21 - 5.6.28
Fatal error: Call to undefined function mcrypt_create_iv() in /in/hSF3C on line 8
Process exited with code 255.
Output for 5.6.8 - 5.6.20
Warning: hash(): Unknown hashing algorithm: base64 in /in/hSF3C on line 22 Warning: mcrypt_decrypt(): Key of size 0 not supported by this algorithm. Only keys of sizes 16, 24 or 32 supported in /in/hSF3C on line 26 Encrypted: string(974) " RW81TzczRElWOVROZE9MWE1JVmtSWmk3MjRBZW5NdWdWZnhYU29DWEttMVN0VUhmCi1fY3dxWVJJNHNkbXQwVXNHLWoyOVV3OFU1MG1yWnpyR3RXcG8taWF3cUFTVWxyZQpWUFRiTFVUc0hKR0NaNWNFbWx4UXZaRGYzb2xOa2Nibm81Mk9wN2VDRDE3T0hHbE8KZWU1bjhmSXkyUmRfSTI3YWp0NXoxXzJOdjl6N2ZoazZQaHZVQzVkRzY4UklONkVOCnlsTDdRTmlDMlJqRndTUU5Icm1YUmstX09tZzhmN1J1bTdfbzQ0c1pJQkVLOFJWagp4MjdqcXdGSWY1am1kdE5NMXdhRXIzMDJPTENMbXF5endwbFN6cWc4WmFmazRrS0MKaEFNTjJURnZINjBzR0lZSmpTdTJmcDJ6Mnp5WEl4Z2toSV9VWjRwOXloUjdNTFZwClV4SEk2ZC1fRzg4eUphU2FhbGlYS194TFVhYVZ6RFl0S2ZEckNzNkF6dGprLS01UQp2SHJ4R2p6dFZiUHN6OUpyMW9kdGxPc2g1cHVOS0s2YkptOEZFSlJKNFVzZW51U2sKZnFkV0d5ekdPQjA4dXg2R2JIWmlPZkRHUjdRNzYtdnJLOEtmaG9ILVowd3BoRV9zClNEZnIzMW0wMk55TFFCbWdiQTVrOEduOHlIVXlya3NtY2xWSWNtVVFZdXhObkdYbwpRaU56d2tVV0NJVjJZZHR2NjlWeU5GVWctOFZBYk9HNWFxaVJvUGxQZ3IycVlBNG4Kc0JfQWFjd2pkMFV5LWxYRThFZW9BSXhYMFBTbldQUVNwcllyTTRaQ0xvUjRwY3puCm5PakFuclNTZ2UyNWE1bzRweTdUekNVYW5kMlZKNE5Jei1rdnI1Qmp6OW9UZlc3UApwVHZDOGg0cHV0SW1NQWFmLUc5X2xzM1JzSlcwYndXUkVpSnNTT1dSeGQ0 " Decrypted: string(0) ""
Output for 5.4.9 - 5.5.34
Warning: hash(): Unknown hashing algorithm: base64 in /in/hSF3C on line 22 Encrypted: string(974) " RW81TzczRElWOVROZE9MWE1JVmtSWmk3MjRBZW5NdWdWZnhYU29DWEttMVN0VUhmCi1fY3dxWVJJNHNkbXQwVXNHLWoyOVV3OFU1MG1yWnpyR3RXcG8taWF3cUFTVWxyZQpWUFRiTFVUc0hKR0NaNWNFbWx4UXZaRGYzb2xOa2Nibm81Mk9wN2VDRDE3T0hHbE8KZWU1bjhmSXkyUmRfSTI3YWp0NXoxXzJOdjl6N2ZoazZQaHZVQzVkRzY4UklONkVOCnlsTDdRTmlDMlJqRndTUU5Icm1YUmstX09tZzhmN1J1bTdfbzQ0c1pJQkVLOFJWagp4MjdqcXdGSWY1am1kdE5NMXdhRXIzMDJPTENMbXF5endwbFN6cWc4WmFmazRrS0MKaEFNTjJURnZINjBzR0lZSmpTdTJmcDJ6Mnp5WEl4Z2toSV9VWjRwOXloUjdNTFZwClV4SEk2ZC1fRzg4eUphU2FhbGlYS194TFVhYVZ6RFl0S2ZEckNzNkF6dGprLS01UQp2SHJ4R2p6dFZiUHN6OUpyMW9kdGxPc2g1cHVOS0s2YkptOEZFSlJKNFVzZW51U2sKZnFkV0d5ekdPQjA4dXg2R2JIWmlPZkRHUjdRNzYtdnJLOEtmaG9ILVowd3BoRV9zClNEZnIzMW0wMk55TFFCbWdiQTVrOEduOHlIVXlya3NtY2xWSWNtVVFZdXhObkdYbwpRaU56d2tVV0NJVjJZZHR2NjlWeU5GVWctOFZBYk9HNWFxaVJvUGxQZ3IycVlBNG4Kc0JfQWFjd2pkMFV5LWxYRThFZW9BSXhYMFBTbldQUVNwcllyTTRaQ0xvUjRwY3puCm5PakFuclNTZ2UyNWE1bzRweTdUekNVYW5kMlZKNE5Jei1rdnI1Qmp6OW9UZlc3UApwVHZDOGg0cHV0SW1NQWFmLUc5X2xzM1JzSlcwYndXUkVpSnNTT1dSeGQ0 " Decrypted: string(720) "�K��js`�'�~��դ���Z/0�b"�`&:6,dY�~��%d�u��bE��B&���QH|�$��Oj h?Z����~&��1���T�X]x�Y�o� �.�e�\F./�Q����;�χ�\���p�f��l� �Z�w���5T��2"��J���(������D��\r����?�P�&�w�_�,'��=�?#NVZ�+���@�~�x!�,���d:E�Y�+��尦N�)�X��rN�`�Lۤ�dOG:6A{]Z��E?�h�C�h��&��_���r��4����@sÖ�R8 ����|�<ڱ� -vK���P��9�X��ڳԢ�3]�'� �$X�< dU�������{; �Ǵ b}�qRYsby1r`$�'S�N�t��KA!���1 �:��vsE���$�i�T�$/F�Åy�!�S[|)<�Q��T�1j0������R�P )ߧ�D��{?��{�<�������5>Ȋ�j�B>�' qy��+�F(/���()H��`2Dc�s�Ժ�VPsL �>d�ur�]���5���2�mN|�T�9��N8������q� ��9W�k��}Dd(���!�6/}�id멓%����R�TC�����0 ����J��;~� ~�<�\��t�`\d��`�^fjK�Br��b��/�|d�]�iy��^�( Ľ��M� Ց�XV4 �h�xG�ظ`.n#)$�F"