3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php $key = 'password to (en/de)crypt'; $string = ' string to be encrypted '; // 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 ':' . "\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/7WmQa:8 Stack trace: #0 {main} thrown in /in/7WmQa on line 8
Process exited with code 255.
Output for 7.0.5
: string(64) "3yqAsXYLotBUCA2k5WgFqGKeA51uMJ0rb/+2jII4WIXO8jmIfg/0CybdmFKRuRHF" Decrypted: string(24) " string to be encrypted "
Output for 7.0.4
: string(64) "DTt2VwrLVSH9CT1UQCPSkZiGU4GvT/tOfI8P9l951iBKVJisQiVc4aEjsRpxxCnB" Decrypted: string(24) " string to be encrypted "
Output for 7.0.3
: string(64) "pvmSUb7urVJFLBREqHzqqBlOl8VwCYfdyqJmQv7BM9US8AuK5IBGoUFMBandBdAY" Decrypted: string(24) " string to be encrypted "
Output for 7.0.2
: string(64) "pyn8Kn1/mmGJlGZcWeCoXiTisuIigNI917ORPUuN2o+935LWO2bYK8jkS2a9AZ+t" Decrypted: string(24) " string to be encrypted "
Output for 7.0.1
: string(64) "FdnEfpZSMfM14V+8gHOOXKyivKphE7HTJ5olBPTSQqPy9qfsIKgjeoDBhWPE0KpJ" Decrypted: string(24) " string to be encrypted "
Output for 7.0.0
: string(64) "GB/y9BuJJKGVeL7cC8ofPHX6Yc0ohxuHoIWTUbDOcxfvueyGolXLP4XjYp3XTGfU" Decrypted: string(24) " string to be encrypted "
Output for 5.3.22 - 5.3.29, 5.5.35, 5.6.21 - 5.6.28
Fatal error: Call to undefined function mcrypt_create_iv() in /in/7WmQa on line 8
Process exited with code 255.
Output for 5.6.20
: string(64) "DJSUbtsk9krS1eJ17ZVGNkmYqGl2heoyW+rBYgDWqE5XBYxrTU6L3pYU0RgL0OWN" Decrypted: string(24) " string to be encrypted "
Output for 5.6.19
: string(64) "M7g41QK/NlUto65ge9n5mqk+cWDFNrFHZ5n2YaEQYpsVcySQ4IWrpVo8k3hkpKFn" Decrypted: string(24) " string to be encrypted "
Output for 5.6.18
: string(64) "M6LgOwAsUaFjAlE7j0nHcjB0boDzKIQo9M8ONoiSe3H1xNNR6pJ79zamRDvWPDL3" Decrypted: string(24) " string to be encrypted "
Output for 5.6.17
: string(64) "gnSfRmlAOb/38i0beNPbI4cnWkSlTilWorkqfxg3qLvfDFBtqUL3+YAdoxCce/7f" Decrypted: string(24) " string to be encrypted "
Output for 5.6.16
: string(64) "JspHwxYiZIqx49vaS6QwkB7fCFCp4LiWXs/CqrJGBUtAxILDj72rCMFJqA0yPYW1" Decrypted: string(24) " string to be encrypted "
Output for 5.6.15
: string(64) "ECWTOrvEt0pE5zck+sWgxZF32wQbmwqK7316466M6MW9xj5bZ/wQZjNjCtB3h2cV" Decrypted: string(24) " string to be encrypted "
Output for 5.6.14
: string(64) "s33easkFZL+6UpK8xt+kxYkF/VvUdOUoGGosMS0p7zlzeS27SWg5cbxpdWc/ddVE" Decrypted: string(24) " string to be encrypted "
Output for 5.6.13
: string(64) "nJsG1381GjuDmmwMnupPUvopdK2RoF1KRcQrPTxN1YS3MxkDQY/tWpINd8YKTNxB" Decrypted: string(24) " string to be encrypted "
Output for 5.6.12
: string(64) "u1KHPNblo8zjGrtsE+F1vNDwwooLa4KgDPfdWKG0WyAsRVLtaF/m9Jtdwokc0B+I" Decrypted: string(24) " string to be encrypted "
Output for 5.6.11
: string(64) "mtVAqGvDM4AYNNdygOH+L8wOCBHKKALl1c4d9ozaRLlgx97LhB1Gluqy+S4siSa4" Decrypted: string(24) " string to be encrypted "
Output for 5.6.10
: string(64) "o8Zufritb5LlYrBrBdTMprIueH3TTXtbzNV8tdPI5WCCyBLJ/K1EV2P18FuJx1Wr" Decrypted: string(24) " string to be encrypted "
Output for 5.6.9
: string(64) "w2EMkzyEUWoMtQ3fuqXxuBpibKHaP1cbQYsDDxZzCW9/Eg5H+My49vUUXBqupMMT" Decrypted: string(24) " string to be encrypted "
Output for 5.6.8
: string(64) "3SPvg+/G21ukpNbGedUKbOTFpRgalE+SfI12sd0yrYxbVXrLFwGlmhQKurynzxmn" Decrypted: string(24) " string to be encrypted "
Output for 5.5.34
: string(64) "WPq4FX+IP7B55tNjeO/6YwvCPFbMswzm7Yv/K42/kaMjSHA5Lk/oq8QXAjRJafxQ" Decrypted: string(24) " string to be encrypted "
Output for 5.5.33
: string(64) "efSD6AJloYealwk+ekPG7wH0L5dIFek16VXAQ8GBzBf76cJVj4KxFCNKXrLGzGMK" Decrypted: string(24) " string to be encrypted "
Output for 5.5.32
: string(64) "BFQ1svKQszg/ONtff3VtBHUrXKfF+zjIO5AewZxdwBvA4q/5RjgKfC3h+wB9Z0mS" Decrypted: string(24) " string to be encrypted "
Output for 5.5.31
: string(64) "5dEEqFRictZwSimyPEYvHIZoS8qz+LlEY+Kg91XLUWHRX8h3O9ovHPF8abENh798" Decrypted: string(24) " string to be encrypted "
Output for 5.5.30
: string(64) "6FtwudXhzzoeKb6hPjGmPzg2q67vVSDWe78mAGudBHeZD/h8g4ar6YUhWSqHzyWD" Decrypted: string(24) " string to be encrypted "
Output for 5.5.29
: string(64) "3nvXKGCjcYk9dGMnwbPNC4WxoTysIKSQE85o11PCU4eE2qOwOl9JgbFhosTt1fjj" Decrypted: string(24) " string to be encrypted "
Output for 5.5.28
: string(64) "soxNSANY0jwiaAaZFegWg1UI0JOaGNNyPT/0psXe0jh9hP32SUmX4uA6Jg+IVLqz" Decrypted: string(24) " string to be encrypted "
Output for 5.5.27
: string(64) "47Ih56USW8CpqcPXrpQHr3cxLbVj91o5ltUB7EwyHJ4lwktoew7PToT0hxqdK5Jl" Decrypted: string(24) " string to be encrypted "
Output for 5.5.26
: string(64) "qv1HaDCnbFB80lyOBMAwcUb4bRV2D1hXnS9E07MuBWU91QXr1rKu6hd2T1rNqje5" Decrypted: string(24) " string to be encrypted "
Output for 5.5.25
: string(64) "XhCRmLOn9dKdvPup2kMwMCRQxVOO9NS9hLUByUlMUX3KNEHLhJrwLNoaUv4mTIqw" Decrypted: string(24) " string to be encrypted "
Output for 5.5.24
: string(64) "FAyh4j4NL3J33VQHsFVJv+SuiVx6QyGimtgycGfD0dW2jsA9+CyHeLFKj2H47bSw" Decrypted: string(24) " string to be encrypted "
Output for 5.4.45
: string(64) "HW0k8++n+FKqEEVgpV07PLZFFYn9276WMl8/OWUe365Wjo8/Q8T/HdUedhki4fkq" Decrypted: string(24) " string to be encrypted "
Output for 5.4.44
: string(64) "3sqRrggAZstQT8ZKNVn0zp6T1r4GJNI3ua6Guv872odGgJdjozl3CClPkCcmGLAk" Decrypted: string(24) " string to be encrypted "
Output for 5.4.43
: string(64) "IkdqgolPMCPjTJO/Cev0qBB/7FYhSx5cxx9KBE9QVey2hYE/8ohEAdbr4C9vtmPL" Decrypted: string(24) " string to be encrypted "
Output for 5.4.42
: string(64) "nmM2O0eFeUVY/t7T+XOOul/v33OYVkDq7Nq9+MkyXh0/tk44ns/21aMI7q7pVt1m" Decrypted: string(24) " string to be encrypted "
Output for 5.4.41
: string(64) "sJueRgwGg93qN+drpVxjpttrPIQpR26qjbLlQWFf5ybcdC2uqXvmZMhDbuhEXyt1" Decrypted: string(24) " string to be encrypted "
Output for 5.4.40
: string(64) "EFIMGvYD8eAs8zurtYoJzz20JUAyz8xuqm+Z5y41w7l3Ugkfx4qzyIDn1rNKBv5c" Decrypted: string(24) " string to be encrypted "
Output for 5.4.39
: string(64) "K89WoiY53K9oy8mn2BdQBBofKWohuxptVbU2mnknAARc7YQleYAqVgl42JDq1kjq" Decrypted: string(24) " string to be encrypted "
Output for 5.4.38
: string(64) "g7rOWWqh5jpCMA9f33uzQIcjp2oBxsJ7/zJBry6lWDYQQNdyPkjkJ7lLy2wQ6WZX" Decrypted: string(24) " string to be encrypted "
Output for 5.4.37
: string(64) "X7dmJijYNkCjtN1ZaRfx24YyY4HWBwb2yI36kw7u10hZ8e/6GNzlbDSlShfI8wd8" Decrypted: string(24) " string to be encrypted "
Output for 5.4.36
: string(64) "p46/ky0MPnzzNvSYUbH6ZEQKE9V3fxOZ3YUm6LQiprSOnAiwSR/lhYXUso3KKtGU" Decrypted: string(24) " string to be encrypted "
Output for 5.4.35
: string(64) "h3QmMtTV/jnQ0bOpa+Rv5A4sHXaJnt+rWhxtzw7SDQCcSSBu+M3o/EbczDtQgjfY" Decrypted: string(24) " string to be encrypted "
Output for 5.4.34
: string(64) "eRF6UYPrvJEw86pAfgb3cUB6Rm2lL2h8/w7yXoc1wJ5Gyhtl8ugTuSvcZvrlocF7" Decrypted: string(24) " string to be encrypted "
Output for 5.4.32
: string(64) "KvK+dm1kQvIMeRBF6BPH3Gl+g3vVUJaz9SUp7zAalsuXvvIztRFFncthsX1ylxzo" Decrypted: string(24) " string to be encrypted "
Output for 5.4.31
: string(64) "1Dd9vCBW9haTwSok6uZIf2Mivl10QQDr4crP0Uwj4M2mzD32Zw3VUuNGepp05iG/" Decrypted: string(24) " string to be encrypted "
Output for 5.4.30
: string(64) "yUiMNZlA4cZL7z4bnq5NrVZw0tMxEUBM1xs4BqReAFDHsHBVwkCVTnFSKSxTdloi" Decrypted: string(24) " string to be encrypted "
Output for 5.4.29
: string(64) "gDA16CRm4ZAHD5NIMCqJCMwzMuoVSkTj1uMtEyolYry2NxU083b9aDr70sdD5ubd" Decrypted: string(24) " string to be encrypted "
Output for 5.4.28
: string(64) "A6Olt+uNRsZFsBV9Y+yej2AnOPUqsZFv7EHheQ5T0aFDpqUXtjTb0/uQMI0Aanlv" Decrypted: string(24) " string to be encrypted "
Output for 5.4.27
: string(64) "pn6B/vXNH4vonr3DP/LrV7t4ccUZ7XfUB/4xXTxpa4OOek+cztndN3j0lsB6se6/" Decrypted: string(24) " string to be encrypted "
Output for 5.4.26
: string(64) "FLTlWAfFM8lKmkbAUkfbpthOQBu0t4Ip6BY7+tfYppLxLCgzcOVoEJm92h/241G1" Decrypted: string(24) " string to be encrypted "
Output for 5.4.25
: string(64) "un7dyhppSq+xITmFeUyxJxaeDMkW9FoxRMjOqjJlQqpZI0wOYiTQCnJ52Dh9IOLl" Decrypted: string(24) " string to be encrypted "
Output for 5.4.24
: string(64) "AEW68Ov7YTj0iP6zIpifp42JUVmzTI4Z0qhex1/mo2n+le8RaOEYEVsopiK9sgj2" Decrypted: string(24) " string to be encrypted "
Output for 5.4.23
: string(64) "FobG1A5XfwL/W2sS3Ii/r4KvqvJ46irExk0mZk+GevCBsqO8Jj0WPGWIbD5WlHCE" Decrypted: string(24) " string to be encrypted "
Output for 5.4.22
: string(64) "YJ4fF0E9d/Uw26Ddc+5g5PKm2kNbcBJQWkxBlUOMMVQCTvVeLXm46L1wi6BQYZee" Decrypted: string(24) " string to be encrypted "
Output for 5.4.21
: string(64) "IglaCXWTe75TIVx4B7WW5+gqKN4p6drTS+zHloJlOIAb89hcS8N2o/FjHES3JeF5" Decrypted: string(24) " string to be encrypted "
Output for 5.4.20
: string(64) "XhNiPOYQOJVhPyg69CKG88U6UPFTPA+yWL+R+G/1JpKFJyMHrbueU4mDGnr2Oiei" Decrypted: string(24) " string to be encrypted "
Output for 5.4.19
: string(64) "VljoO+Pu8SNUWX/PDhm4Vv6pvzj0yAxKUrhSysG67Xzyym77OVZBUS/wuaYr3jSV" Decrypted: string(24) " string to be encrypted "
Output for 5.4.18
: string(64) "t3biyeq3NjSJbgOxXyDU+Lopb+hltqmRgz/iJgm0oAh1zm0ACFrIBI8BLY5WTMSz" Decrypted: string(24) " string to be encrypted "
Output for 5.4.17
: string(64) "sfwPRHbeGm/esAAD8Mo5xyw50Ax8USVw0Bys6770qZidFLgEyA7EWu+iQvmlnml0" Decrypted: string(24) " string to be encrypted "
Output for 5.4.16
: string(64) "K806SqyTUREe9XKmj5Yr5zNByT78o7dRPPhtJaCvU+m64EfjiNKi/SH9tBSzagxm" Decrypted: string(24) " string to be encrypted "
Output for 5.4.15
: string(64) "6WpzXBOXOZC1bCK296c11sYBtAXNzIcOgYV8XJrLVfqvkz/E7hw0AsUNd8ZxuKOY" Decrypted: string(24) " string to be encrypted "
Output for 5.4.14
: string(64) "1tENTD083VJp+E3Xb0TR/5Ut/DLN1LB3J8ofGefNQvbTUUxcJeDOQCf9h0Cehj+2" Decrypted: string(24) " string to be encrypted "
Output for 5.4.13
: string(64) "PyGqfy68k0ndqAxqmdo83lHDL8uYVdha/pSr4KaJ3ctb1j+x+XONTvfWj9uidcpO" Decrypted: string(24) " string to be encrypted "
Output for 5.4.12
: string(64) "3vhq1Ka2BYMm0Z6aqz8fu3Yrlte22TjHuLViViWTNZDvzd8qBpR9Gn9YCAhjdJ/8" Decrypted: string(24) " string to be encrypted "