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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('sha256', $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 T0inD
Output for 7.0.6 - 7.2.0
Fatal error: Uncaught Error: Call to undefined function mcrypt_create_iv() in /in/X6k3n:8 Stack trace: #0 {main} thrown in /in/X6k3n on line 8
Process exited with code 255.
Output for 5.4.9 - 5.5.34, 5.6.8 - 5.6.20, 7.0.0 - 7.0.5
Encrypted: string(974) " RW81TzczRElWOVROZE9MWE1JVmtSWmk3MjRBZW5NdWdWZnhYU29DWEttMVN0VUhmCi1fY3dxWVJJNHNkbXQwVXNHLWoyOVV3OFU1MG1yWnpyR3RXcG8taWF3cUFTVWxyZQpWUFRiTFVUc0hKR0NaNWNFbWx4UXZaRGYzb2xOa2Nibm81Mk9wN2VDRDE3T0hHbE8KZWU1bjhmSXkyUmRfSTI3YWp0NXoxXzJOdjl6N2ZoazZQaHZVQzVkRzY4UklONkVOCnlsTDdRTmlDMlJqRndTUU5Icm1YUmstX09tZzhmN1J1bTdfbzQ0c1pJQkVLOFJWagp4MjdqcXdGSWY1am1kdE5NMXdhRXIzMDJPTENMbXF5endwbFN6cWc4WmFmazRrS0MKaEFNTjJURnZINjBzR0lZSmpTdTJmcDJ6Mnp5WEl4Z2toSV9VWjRwOXloUjdNTFZwClV4SEk2ZC1fRzg4eUphU2FhbGlYS194TFVhYVZ6RFl0S2ZEckNzNkF6dGprLS01UQp2SHJ4R2p6dFZiUHN6OUpyMW9kdGxPc2g1cHVOS0s2YkptOEZFSlJKNFVzZW51U2sKZnFkV0d5ekdPQjA4dXg2R2JIWmlPZkRHUjdRNzYtdnJLOEtmaG9ILVowd3BoRV9zClNEZnIzMW0wMk55TFFCbWdiQTVrOEduOHlIVXlya3NtY2xWSWNtVVFZdXhObkdYbwpRaU56d2tVV0NJVjJZZHR2NjlWeU5GVWctOFZBYk9HNWFxaVJvUGxQZ3IycVlBNG4Kc0JfQWFjd2pkMFV5LWxYRThFZW9BSXhYMFBTbldQUVNwcllyTTRaQ0xvUjRwY3puCm5PakFuclNTZ2UyNWE1bzRweTdUekNVYW5kMlZKNE5Jei1rdnI1Qmp6OW9UZlc3UApwVHZDOGg0cHV0SW1NQWFmLUc5X2xzM1JzSlcwYndXUkVpSnNTT1dSeGQ0 " Decrypted: string(720) "�.���_*��OB1|)�6��~����BD��S‚� ���XR���%p��YQ^�Sm�`Y3K����9/���/�@�7�&Z�N��Ă{���}Ff��-J�*��\��*��'�3��?�'M2݉���CQ�3� .8���#��w��jcM�ը�/�Ax�#B���k���Cܲ�J�BE]��ɮ�W�d\e(9� �XpGц^!^ˢ�ؖ�#�n��"�˙�6��� c����ш��>�D�vdG{�ی�mc,��qvw3Up^����~�3�O+B�b������sI;��2 &C^��z�v�<��me&�{�Ƥ[��p�I2��'�Uz�'��zLJ�猉�\G,�W/yp>ՙ��Fw��S&=�ꠔD��G���.w���b�n��F�7�D�W$�鍶�4� )��s�X@�;6�X�Q���(�,W��#[�UO�)�I����8cL��(��;y�й����b�Ţ�� y"0���Eۀ�/�@����k���yjX>�n2��-T�~���ZbUES�¨C�>C�b �� �u�d�� �ᭈ��$��E��DH�k�.�j.��E�!���~��V�؂�YNq�eX��n F�U����ߎ4��=F��,H�sJ���� %�;��Y!�Qhg`��#��������e6�g�BLB��%����� rn��7J��vV6"
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/X6k3n on line 8
Process exited with code 255.