3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php $key = 'ghfgh'; $string = ' fgfghf'; // 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 CJfSn
Output for 7.0.6 - 7.2.0
Fatal error: Uncaught Error: Call to undefined function mcrypt_create_iv() in /in/v4geG:8 Stack trace: #0 {main} thrown in /in/v4geG on line 8
Process exited with code 255.
Output for 7.0.5
Encrypted: string(44) "+9JKu8Fbnyg7sa7cSEwzo6U5bzY7C88hnrDa6POqKQ4=" Decrypted: string(7) " fgfghf"
Output for 7.0.4
Encrypted: string(44) "sjjfPVdOQcKSaegMjBTKho4jteDFyle9+CiDURherQs=" Decrypted: string(7) " fgfghf"
Output for 7.0.3
Encrypted: string(44) "yRhiClCKgcksANKGO13ouozePsDCXIvNOZC/z6jW3VU=" Decrypted: string(7) " fgfghf"
Output for 7.0.2
Encrypted: string(44) "n6+tMnur2MdEOwTz6dt2AcZesEJRG2Tee+fv95ltqK0=" Decrypted: string(7) " fgfghf"
Output for 7.0.1
Encrypted: string(44) "wk+FlKLZCYdlVlCpadnQuyr/k1LzYKT5XuMvm17OaG4=" Decrypted: string(7) " fgfghf"
Output for 7.0.0
Encrypted: string(44) "n+tELm5ku/ikI6R1bk89YNzfZB1BBgtAIKq5+QrQ1kM=" Decrypted: string(7) " fgfghf"
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/v4geG on line 8
Process exited with code 255.
Output for 5.6.20
Encrypted: string(44) "9Q5m+ZZyteqbcIpUC28psv/efSMyd2XC+0iDdsqXlkA=" Decrypted: string(7) " fgfghf"
Output for 5.6.19
Encrypted: string(44) "C9X70iu4TQhM5rSlY8lAomQgKkZPyaPiiykAY1zw+oc=" Decrypted: string(7) " fgfghf"
Output for 5.6.18
Encrypted: string(44) "FzUtoWNEipeWKnGfLJIZ/0p2O6c0M+Lk69g1EQaQ4F4=" Decrypted: string(7) " fgfghf"
Output for 5.6.17
Encrypted: string(44) "w12b3v4/Usx1ZABNFzFa2RsjdHrCOZIgScMZRyycoCI=" Decrypted: string(7) " fgfghf"
Output for 5.6.16
Encrypted: string(44) "ijGjRI5dfnj0kdxGSPUSKVI2yHKAyl3bbj30oxbNbD0=" Decrypted: string(7) " fgfghf"
Output for 5.6.15
Encrypted: string(44) "EsMhES/P3JE5xeXaMiccwlRgu7EY4bjEM5CoQorg8To=" Decrypted: string(7) " fgfghf"
Output for 5.6.14
Encrypted: string(44) "km7YSwiv84bbHz7UdoLi8P5KO9AAh/LsRVfyOtVCi4c=" Decrypted: string(7) " fgfghf"
Output for 5.6.13
Encrypted: string(44) "3iLi6wxA/FMdR3XCXvzCO2rqR7ENtdXbcR/LdBEQCwQ=" Decrypted: string(7) " fgfghf"
Output for 5.6.12
Encrypted: string(44) "IgtEJpRz26XeH/TJOyBaTULqyAoXHTA5qYe+xqBd6Xk=" Decrypted: string(7) " fgfghf"
Output for 5.6.11
Encrypted: string(44) "vX3FRXSAkVqRTkoySsiemckQ5yCGrRoZLhScqgx26Rs=" Decrypted: string(7) " fgfghf"
Output for 5.6.10
Encrypted: string(44) "ucmrmNhtrqyyAIQhgN402/1hqykZOzbkDkpsuxMMztQ=" Decrypted: string(7) " fgfghf"
Output for 5.6.9
Encrypted: string(44) "Ucu6V7MKn6WEnpgLWMviVWnHmQr4y0IVlijEWfxCd8Y=" Decrypted: string(7) " fgfghf"
Output for 5.6.8
Encrypted: string(44) "kM424CkP6A5IHSMfeU8mVCCF3SzEH2E6JysEbm+wkf8=" Decrypted: string(7) " fgfghf"
Output for 5.5.34
Encrypted: string(44) "+d8rk01Y6HpcXKZhRZRljeJHNCsPRNYVLSnTdM3rcsE=" Decrypted: string(7) " fgfghf"
Output for 5.5.33
Encrypted: string(44) "5+Z6crtVT6qWlnVQsDE3pQGpkC7qEKS8zzHZZwjaBDY=" Decrypted: string(7) " fgfghf"
Output for 5.5.32
Encrypted: string(44) "hzdvokJ2BImNXzj8D1hqZFQDpiR3RFeCmjQf/D5TYSc=" Decrypted: string(7) " fgfghf"
Output for 5.5.31
Encrypted: string(44) "ipeyXt03xSEW8yaoNXvYnDq6uBKSKDPgbZ7DvlSCtsQ=" Decrypted: string(7) " fgfghf"
Output for 5.5.30
Encrypted: string(44) "7xTXK/yS2c7oGEtlxgTFL7Qbs1ANZVq+c3WRMtX7oHE=" Decrypted: string(7) " fgfghf"
Output for 5.5.29
Encrypted: string(44) "qcSSP/yaFPaJCqiYEJlxA1e4QuS+sjPqmaxizioZQss=" Decrypted: string(7) " fgfghf"
Output for 5.5.28
Encrypted: string(44) "ws3ASDdsIGsq4DxbuNFHzsP/MIuCEpUWi6biISpxVJ8=" Decrypted: string(7) " fgfghf"
Output for 5.5.27
Encrypted: string(44) "3Ka1N/KRP42fwce3BA9BU91j1GfjHwuzjECZFfaOUpQ=" Decrypted: string(7) " fgfghf"
Output for 5.5.26
Encrypted: string(44) "xB0JgIi7IDK5jpDRVhwPUC/dfGWj+uATdFN3HCnfGko=" Decrypted: string(7) " fgfghf"
Output for 5.5.25
Encrypted: string(44) "8aYRfm5OW5qBM0jMEHDHElks3iL0/wKq3Mlu7fEkQl0=" Decrypted: string(7) " fgfghf"
Output for 5.5.24
Encrypted: string(44) "Sbxehnp7oOyp7mIgLfSCSA2soCQ4wyB0PonICjEyduU=" Decrypted: string(7) " fgfghf"
Output for 5.4.45
Encrypted: string(44) "bbH6TTL4x55UvSXsIWkzgbCTnWb3JQbGgZyGLQWDgYY=" Decrypted: string(7) " fgfghf"
Output for 5.4.44
Encrypted: string(44) "Bnhg//BksAJG5A6Z96QnH7zD6i5JA/wFoQ+W6F+bpcg=" Decrypted: string(7) " fgfghf"
Output for 5.4.43
Encrypted: string(44) "Rx0kPZ4BvdyHDvT8SG0+Cn164i2rA/yh+lE1h5hH/1M=" Decrypted: string(7) " fgfghf"
Output for 5.4.42
Encrypted: string(44) "tO5dnfnC/W8GFLVVRLP8r/J8h1MFfNs6vEYy4SInazQ=" Decrypted: string(7) " fgfghf"
Output for 5.4.41
Encrypted: string(44) "i5GxXfQQtQjsQTWfkDXaMMAfjpuJaB/MjxRHOb24j7g=" Decrypted: string(7) " fgfghf"
Output for 5.4.40
Encrypted: string(44) "ofIyKeiOdpN7//6VItLlnuJ0GHjyDow+RwkO2Jpv/o8=" Decrypted: string(7) " fgfghf"
Output for 5.4.39
Encrypted: string(44) "unVOtZa2huaTV/8OTIpAJdHBW62WGLYjWJGmt12z9RI=" Decrypted: string(7) " fgfghf"
Output for 5.4.38
Encrypted: string(44) "oisGaW6rwV9Wu7JljwvF/+cNQv1CFooyUVUFOj67XBo=" Decrypted: string(7) " fgfghf"
Output for 5.4.37
Encrypted: string(44) "7JgWlQ4hjb8BxKrsC+LzpG9FpHozqT4sKu7MzVoh+gY=" Decrypted: string(7) " fgfghf"
Output for 5.4.36
Encrypted: string(44) "IsKjgIuVzAO6Ym8E/w9qGDmXCzWTZn25PYK6u+o0x6k=" Decrypted: string(7) " fgfghf"
Output for 5.4.35
Encrypted: string(44) "cLaO/m7rXEJXWrapWD7QQ2mH8NZtptqMCVRQP+xek94=" Decrypted: string(7) " fgfghf"
Output for 5.4.34
Encrypted: string(44) "RP93UqQmy1zhb1yYPp+4t2TJC3jmOfnm3sZA35FdlV4=" Decrypted: string(7) " fgfghf"
Output for 5.4.32
Encrypted: string(44) "2q0b/yjDn2IthvBdNlBuhVfRz2oQ3M+83dCUyuIefU4=" Decrypted: string(7) " fgfghf"
Output for 5.4.31
Encrypted: string(44) "G2J5uGtm/rzOME5CHJYasGaaTq8k8tkWiaDZadlApws=" Decrypted: string(7) " fgfghf"
Output for 5.4.30
Encrypted: string(44) "5hxaHOGDEIkPRLs2IWAFIJ62AhCH3M0uEhrduLUF3Zw=" Decrypted: string(7) " fgfghf"
Output for 5.4.29
Encrypted: string(44) "NlckAaHP05k8XeEeuzhNW1uxvY8JDbGJAPo8EUwd7a8=" Decrypted: string(7) " fgfghf"
Output for 5.4.28
Encrypted: string(44) "54xxTLwsl5Myw/vpmj9c+fyAlvSkyarrVqVY0R7XZ7c=" Decrypted: string(7) " fgfghf"
Output for 5.4.27
Encrypted: string(44) "FSwkBAYz/hQ8CSjBFS4ikrXM2u8ufYzIs0R5zfMqqAo=" Decrypted: string(7) " fgfghf"
Output for 5.4.26
Encrypted: string(44) "6A/tDWwllc6MesQf59stGegUZzzCFml7XRV1XE+2FvY=" Decrypted: string(7) " fgfghf"
Output for 5.4.25
Encrypted: string(44) "H4mA44orp8ZtOjl+y6fswIn1C9FZOmw4XwlZbLrkXfs=" Decrypted: string(7) " fgfghf"
Output for 5.4.24
Encrypted: string(44) "O5gOQM7rjyFWPRr5jZNcgq8PBQ3YDmq22/n4oEq19tE=" Decrypted: string(7) " fgfghf"
Output for 5.4.23
Encrypted: string(44) "fVX5pnaKGFab2iNSSAVLuuhdtqYgakhu+T0CKD5Y/eo=" Decrypted: string(7) " fgfghf"
Output for 5.4.22
Encrypted: string(44) "zPENBrNDCZXgtAoFqFdyzAKrAHUV/UYbou3HeokGmyw=" Decrypted: string(7) " fgfghf"
Output for 5.4.21
Encrypted: string(44) "SvMVS8HVwBXsLIsm85F18x1iVc7ZQhbDSrxTOybp2J4=" Decrypted: string(7) " fgfghf"
Output for 5.4.20
Encrypted: string(44) "ZH+aRbXYJWbO0lWhHbGycSlNVpYuu2wkuVgfJPFo2gc=" Decrypted: string(7) " fgfghf"
Output for 5.4.19
Encrypted: string(44) "k2KtaIgyXM5Mpg5G1e5ShwRYEZj7n+6bsEvdQql89jA=" Decrypted: string(7) " fgfghf"
Output for 5.4.18
Encrypted: string(44) "b0f1hdpxRHjVcYHlyt2WrLMZ/0L8HNXGyQZLqQkAV+k=" Decrypted: string(7) " fgfghf"
Output for 5.4.17
Encrypted: string(44) "X3+pVct3a99erpWdPoL1Ex6Vg3S1YtJaUbVdrE0fP7M=" Decrypted: string(7) " fgfghf"
Output for 5.4.16
Encrypted: string(44) "oJQUZefgwKjnXJzUOvyk72+a3zGo2lTyg9Q0f5sxHC0=" Decrypted: string(7) " fgfghf"
Output for 5.4.15
Encrypted: string(44) "pBipr9HWgp6yXZtd78cTeaI2krQTpGU+J+BSXPAN5CY=" Decrypted: string(7) " fgfghf"
Output for 5.4.14
Encrypted: string(44) "jVO48p3zYmHyWnn5vQ9h9xX7Ke3XmwNFQRiCel0Brec=" Decrypted: string(7) " fgfghf"
Output for 5.4.13
Encrypted: string(44) "f+cVBlUXes5EFxsAo/U4MrAV2w2un+8yPmr0oFfmDtE=" Decrypted: string(7) " fgfghf"
Output for 5.4.12
Encrypted: string(44) "Xgggr1Uj1vpmx8YWX075k6SmwcTxmUb/rXmqndBuUGE=" Decrypted: string(7) " fgfghf"
Output for 5.4.11
Encrypted: string(44) "WwMNZo5L9upWKth9JwA+3Jpeo0rKrRYFGC7n74pH1wQ=" Decrypted: string(7) " fgfghf"
Output for 5.4.10
Encrypted: string(44) "PhgDw6beozWdEO3zL63m27IsqNStpFX2qxhjLwXQGmA=" Decrypted: string(7) " fgfghf"
Output for 5.4.9
Encrypted: string(44) "kzXdmJKNsz+OsU9+VTq9xK7On+y3OKTIdzy5S7X5NWM=" Decrypted: string(7) " fgfghf"
Output for 5.4.8
Encrypted: string(44) "sX/iGsP3no0sKGTfB6A1Zk7ogjWlIFplMT1wRGTgzZ8=" Decrypted: string(7) " fgfghf"
Output for 5.4.7
Encrypted: string(44) "5Tge/WNqPdu4DoQyzxHP9C/WhsuLUgRkMRhHxJIqUcA=" Decrypted: string(7) " fgfghf"
Output for 5.4.6
Encrypted: string(44) "soV9QUZl2j6C4+UAM1BamveMMKm7thv3S7A6Ot8jZvs=" Decrypted: string(7) " fgfghf"
Output for 5.4.5
Encrypted: string(44) "v0PL35cba390JySrCunm98/F59+MLN0VLpHcLUuCguo=" Decrypted: string(7) " fgfghf"
Output for 5.4.4
Encrypted: string(44) "sXgE9Iw0cOL+Wk8TxYIWLaoeXqAumbpqi4NZwOtRLro=" Decrypted: string(7) " fgfghf"
Output for 5.4.3
Encrypted: string(44) "svLXMbS5GfMLybw8geozlcjkcxBp2Rkn6FySuP0ulFo=" Decrypted: string(7) " fgfghf"
Output for 5.4.2
Encrypted: string(44) "nCTGDkC/gZWJkgyuJBwNZsufcqlv23oP2eAzZm5ZMh4=" Decrypted: string(7) " fgfghf"
Output for 5.4.1
Encrypted: string(44) "h1HZG9xzfxtCDvrICC0hIekmcsniv8/GnRKuVS0iB5k=" Decrypted: string(7) " fgfghf"
Output for 5.4.0
Encrypted: string(44) "E1Jzdw9CIbBdzPXkjnSM/iQg0tiyrzHRqYCCZdH9fvk=" Decrypted: string(7) " fgfghf"