3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php $key = 'password to (en/de)crypt'; $string = ' $P$BRJk54bLUbFSPSjPMEKhL/n2RoyaTu1 '; // note the spaces $iv = mcrypt_create_iv( mcrypt_get_iv_size(MCRYPT_RIJNDAEL_128, MCRYPT_MODE_CBC), MCRYPT_DEV_URANDOM ); $encrypted = base64_encode( $iv . mcrypt_encrypt( MCRYPT_RIJNDAEL_128, hash('sha256', $key, true), $string, MCRYPT_MODE_CBC, $iv ) ); $data = base64_decode($encrypted); $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 6uuHE
Output for 7.0.0 - 7.3.0
Fatal error: Uncaught Error: Call to undefined function mcrypt_create_iv() in /in/P4abq:8 Stack trace: #0 {main} thrown in /in/P4abq on line 8
Process exited with code 255.
Output for 5.3.20 - 5.3.29, 5.5.0 - 5.6.38
Fatal error: Call to undefined function mcrypt_create_iv() in /in/P4abq on line 8
Process exited with code 255.
Output for 5.4.45
Encrypted: string(88) "U8CEa3Aus/T22/NFZXNP4C5e80OLHlVxfBvtLMc0cxtV+HWBNXWzFPk3NZAkxisEdtTOkEGF6j/Mgu6+E4CxuA==" Decrypted: string(36) " $P$BRJk54bLUbFSPSjPMEKhL/n2RoyaTu1 "
Output for 5.4.44
Encrypted: string(88) "u0eEgY2nigGvc/V+VuV9pW+aHi/J9xbuLevxCMr2NpsAk0/T+Y0D4AsfcCZd3zSvXaP9qTh+FFMKbJGHgYdUKQ==" Decrypted: string(36) " $P$BRJk54bLUbFSPSjPMEKhL/n2RoyaTu1 "
Output for 5.4.43
Encrypted: string(88) "sFlg8H/2fbj1cQzPf13BEeNqABui8nXHJRdWFLtAcO7VbLME4WCpZWhEE1IAgW+3wv9KNZ02dcjR47ziiE00Cg==" Decrypted: string(36) " $P$BRJk54bLUbFSPSjPMEKhL/n2RoyaTu1 "
Output for 5.4.42
Encrypted: string(88) "fqcRON4A+HcHdQwrgI4vjNjr5rMWcZrFk5GpyJzENCUJfXcFTZItZsqqrfsEq9BYuj4AwareQ1xBUIRqbBJt2w==" Decrypted: string(36) " $P$BRJk54bLUbFSPSjPMEKhL/n2RoyaTu1 "
Output for 5.4.41
Encrypted: string(88) "hV/ko56H675zPclBWdb1lz8qPu0bezTHD5KRpoRbh1OeFt+vE8D651XE8HRMmbkzLEddC93GbFNtOOlx+rRs1w==" Decrypted: string(36) " $P$BRJk54bLUbFSPSjPMEKhL/n2RoyaTu1 "
Output for 5.4.40
Encrypted: string(88) "KW+uNo2FlDdIGsDtr9+IUux2YA12/gED+uYLQS6Kmc36on0UH4A5GxqFi1ALKVXF5p0CWfvNDAO0ciBX2a0pXw==" Decrypted: string(36) " $P$BRJk54bLUbFSPSjPMEKhL/n2RoyaTu1 "
Output for 5.4.39
Encrypted: string(88) "pse7A976ia1A8evF9MaaOH9aDU8xPhCV4lOrMMA/vNYXfaQ8PgvRL+hrpgck5tphUkk8Qsdv0Xtg+0vvkgZPCQ==" Decrypted: string(36) " $P$BRJk54bLUbFSPSjPMEKhL/n2RoyaTu1 "
Output for 5.4.38
Encrypted: string(88) "n4byk4vXa+UQ2J7OHi1bJZrWdVHPyTwX9LJtCVijzEwj9VQK8KMpZdj8T5NZCkdCQhTPQMVOVWdHL4gi881xyw==" Decrypted: string(36) " $P$BRJk54bLUbFSPSjPMEKhL/n2RoyaTu1 "
Output for 5.4.37
Encrypted: string(88) "5c5UgEKXFnAh2pLKfxh6YLh1fbDCAqt7YKbS1E1v/emywj9SdYzH5i0CkFXanmyZSsENBkoZm2v2jCFi1ejI9A==" Decrypted: string(36) " $P$BRJk54bLUbFSPSjPMEKhL/n2RoyaTu1 "
Output for 5.4.36
Encrypted: string(88) "dmyG9Z0nzL8KPpOMO5EbVrie0VH7C6TEJK/q3lwzFfe+MOOErQREliidSFToK6E+vGpf2RqOH7tyaCEEzruZAQ==" Decrypted: string(36) " $P$BRJk54bLUbFSPSjPMEKhL/n2RoyaTu1 "
Output for 5.4.35
Encrypted: string(88) "To2ERklIGhbnNNkrZDlNY6AceohgMUmygrvCV3W2MuxPQ2gdGZxoBEGlSTNP/Z0+lwDgizk+9Yvv1OsWFoRGlw==" Decrypted: string(36) " $P$BRJk54bLUbFSPSjPMEKhL/n2RoyaTu1 "
Output for 5.4.34
Encrypted: string(88) "tpSTTPEOlSLsnsaVkxmnbKlGy/8rFeQ36scrByQKipL5cvAn/8sx1LTIWpcjvd8GllYo9BSSUC1UYEDa/hGJQQ==" Decrypted: string(36) " $P$BRJk54bLUbFSPSjPMEKhL/n2RoyaTu1 "
Output for 5.4.32
Encrypted: string(88) "ypJW2fYfptGWUcxITwEsJjIlMHtvvLels+D6jPRZ2z0K/NctQynhqslyZgcRR4w8gzTg15K7bs0ncJ8ehbO5uw==" Decrypted: string(36) " $P$BRJk54bLUbFSPSjPMEKhL/n2RoyaTu1 "
Output for 5.4.31
Encrypted: string(88) "Xrh4CGsFL9E1+CLrIY8w1Xnmao7VFeMWs/WnBXG3FebiBs0+hfzp28lAA4Oa53caGQd99o6Ugdq5Z6lYTUBBNQ==" Decrypted: string(36) " $P$BRJk54bLUbFSPSjPMEKhL/n2RoyaTu1 "
Output for 5.4.30
Encrypted: string(88) "zGRkAg2GjFBJQswI4h5cEiRNSsVRiV9IidtVYDsUPqgFvj9VzKlA3UVH0kqqnDXEWG1Xpq/Wyp/64vhOOqfNzA==" Decrypted: string(36) " $P$BRJk54bLUbFSPSjPMEKhL/n2RoyaTu1 "
Output for 5.4.29
Encrypted: string(88) "51kMdrKSLvyMlwp15e6/Do8St1RDiVTu+xBPkUxvfiqOuwOD9Bk3JVqmg0E6fn8FWcljwGSRTyZYjejj30s8hg==" Decrypted: string(36) " $P$BRJk54bLUbFSPSjPMEKhL/n2RoyaTu1 "
Output for 5.4.28
Encrypted: string(88) "+DlKqr6xgi6Amhd56z29XlHIrSF4PnnwC7WfKruKkpz8iobEvbYZ3o60LBpxemjfolfv01jeuDqmNm7IF9zAGQ==" Decrypted: string(36) " $P$BRJk54bLUbFSPSjPMEKhL/n2RoyaTu1 "
Output for 5.4.27
Encrypted: string(88) "ZsJmvbvPx6OY3S63MgwU03XqLXEMOwzvtblKOyukJzInSX4r7gvU3m7rxT/aRDNCJ1OUpyhRVnca9fGNQet72w==" Decrypted: string(36) " $P$BRJk54bLUbFSPSjPMEKhL/n2RoyaTu1 "
Output for 5.4.26
Encrypted: string(88) "SnFCNTxo5td4VFFqbMm8ILX4SXvVK7ldra/JrUh9edjaEdEn2llLVoYiqQDAogrjlhjvkFtPcDjsACeCQ7KJzQ==" Decrypted: string(36) " $P$BRJk54bLUbFSPSjPMEKhL/n2RoyaTu1 "
Output for 5.4.25
Encrypted: string(88) "kbux87DOzonZd+EBqAhoBPv+EcBUD81rln4RED6Do7oSpGk4vARPO97RSYurkF9HU2BVGu05ifz8rj7rskK9IA==" Decrypted: string(36) " $P$BRJk54bLUbFSPSjPMEKhL/n2RoyaTu1 "
Output for 5.4.24
Encrypted: string(88) "64ZUF/Uam4ZtyrDNECRztUDJ6A2Q5dWr6+YlivkrBY6aT9hSaJx9lY8d+JqdeG9xc9DyIE1dQwvx5/WNtNH+2A==" Decrypted: string(36) " $P$BRJk54bLUbFSPSjPMEKhL/n2RoyaTu1 "
Output for 5.4.23
Encrypted: string(88) "VOV9RuOyQwZe4uopSnPwsE/70Okv9laeJTHwSnj3GFfm1J+Cd05k1KVnaU9+VIxwM05H/OC4TiR1U6+7hPPY6w==" Decrypted: string(36) " $P$BRJk54bLUbFSPSjPMEKhL/n2RoyaTu1 "
Output for 5.4.22
Encrypted: string(88) "pdGbj4Wxe4BTK53zEkVWMAMSdJNcG7vGQoYaibugTdAgrh0QkPkocCoYc3YEY5SiT2QgBAlijXo4QTmpneiflQ==" Decrypted: string(36) " $P$BRJk54bLUbFSPSjPMEKhL/n2RoyaTu1 "
Output for 5.4.21
Encrypted: string(88) "UwUSFEdjMteYeyajQhbGKyVs/2LqooikrasSL044Urdfv5bH/RQh8pWUA5E2opZlDf0smaiR+3H7PSYD/6G2zQ==" Decrypted: string(36) " $P$BRJk54bLUbFSPSjPMEKhL/n2RoyaTu1 "
Output for 5.4.20
Encrypted: string(88) "WW+pWSRpSw2Fr3uzUFpLFV4feAEFqAQb3Z5rr5QP3VbOR4vfEc504W/A10N3VkyLi/+CuzD79QvlPumhpICnVg==" Decrypted: string(36) " $P$BRJk54bLUbFSPSjPMEKhL/n2RoyaTu1 "
Output for 5.4.19
Encrypted: string(88) "Ft0tddYyPOPTwvSwGo/9yteH1YAR1i7T1Q422mcO7foP94Bdjov+RbQalk4xxBIUFx3IZay8TJa13y+4HtUnFg==" Decrypted: string(36) " $P$BRJk54bLUbFSPSjPMEKhL/n2RoyaTu1 "
Output for 5.4.18
Encrypted: string(88) "Z3/5twI3DhiSF0BE5q5uicMtJlWZad8/7oRZ6vJmvFFyRKFXBuoGfdJZ6JGxhQrEjMGhScsJKG9UYerbnDyOsw==" Decrypted: string(36) " $P$BRJk54bLUbFSPSjPMEKhL/n2RoyaTu1 "
Output for 5.4.17
Encrypted: string(88) "OoudFNfAJgYwobiSBHGUWdIWHIPZD7TQNZAKuBP5RSkiFDZQRtdGqooMMrMmoyXwX9Wk9HFh2smuZAa0SMq8LQ==" Decrypted: string(36) " $P$BRJk54bLUbFSPSjPMEKhL/n2RoyaTu1 "
Output for 5.4.16
Encrypted: string(88) "QNBew+bOp+usZBCy4LeRKdB6RTlqLQP1VH/6tIufKtTdtMTusrHlMNOLvwRyDbXbhCkCOeVFD+2TntM9ZcjI6Q==" Decrypted: string(36) " $P$BRJk54bLUbFSPSjPMEKhL/n2RoyaTu1 "
Output for 5.4.15
Encrypted: string(88) "C6CPzWvlf0szg4SHs6DWrwTj/tWqWxF0igxRGXOM0nK0+UaCUY5BS4qXtCLHNuBzgGGTq7c7/mcM1QV9BJeQjg==" Decrypted: string(36) " $P$BRJk54bLUbFSPSjPMEKhL/n2RoyaTu1 "
Output for 5.4.14
Encrypted: string(88) "wuPUraSqfCvtRAeGDUu6i+t0mv7IPbz+iiKHNjeYU2tlPWLrZz3kfFaJur5TvhUhEyF8xukg/OYCGX1Ei110Iw==" Decrypted: string(36) " $P$BRJk54bLUbFSPSjPMEKhL/n2RoyaTu1 "
Output for 5.4.13
Encrypted: string(88) "Djl0kU8v4Y0ktuqLZDa4MeSC5RXfnPes1Lqy688Q25tSIBdGToyxgbvN+jScYLKPNTrkMqGnczJM/S/0ZJ0Mlw==" Decrypted: string(36) " $P$BRJk54bLUbFSPSjPMEKhL/n2RoyaTu1 "
Output for 5.4.12
Encrypted: string(88) "9jGb1yPTStj/tCcde3L+rJsS8RaIsRuXgVED2D0qsDbWomgYF25E/NF+u12epgDyUThCiXb6PEKRtgUkHbQmjg==" Decrypted: string(36) " $P$BRJk54bLUbFSPSjPMEKhL/n2RoyaTu1 "
Output for 5.4.11
Encrypted: string(88) "V2X/UYspM5yJ9cQhhHhHkSjx0bN+Lpk0Amlbgqhte0g/4lS0D42Bpe1ftCr4eDwCW+oMEasAo8FRk/riMJ/aBw==" Decrypted: string(36) " $P$BRJk54bLUbFSPSjPMEKhL/n2RoyaTu1 "
Output for 5.4.10
Encrypted: string(88) "gcIdEaOkCVSFBpiEffIblPkFwJ5c8WaXVfajXvqhHw6S5TOyAbJwsZvREiu0XUJJTgOZY+b8OzIvE+QUCxvktQ==" Decrypted: string(36) " $P$BRJk54bLUbFSPSjPMEKhL/n2RoyaTu1 "