3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php $key = 'password to (en/de)crypt'; $string = 'hello this is demo '; // 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/bMkW0:8 Stack trace: #0 {main} thrown in /in/bMkW0 on line 8
Process exited with code 255.
Output for 7.0.5
Encrypted: string(64) "rZpnogkZWm7hGLNjTaUXU4hqLLAfO3bi50ZcvKCzgp5CgYFxmHuaQkN5OrqtqBWs" Decrypted: string(19) "hello this is demo "
Output for 7.0.4
Encrypted: string(64) "BeEybAfy0ar/amj297LCCTEWHoh6+qbgeKZY2GCcG1DnfjkYQBuI6mttjJW5MtL+" Decrypted: string(19) "hello this is demo "
Output for 7.0.3
Encrypted: string(64) "Fzb2OwuZPc4uhiYdCTNdxx4o+T6llNjQAO+IaXbIZIjsUjEofMSkR4Jchdy7751c" Decrypted: string(19) "hello this is demo "
Output for 7.0.2
Encrypted: string(64) "SmPuDXmhjr2No8D+NGGB2IR/R0rXqk2nCj8D88RMU1rotu8vssIMTnJEg2EuTClG" Decrypted: string(19) "hello this is demo "
Output for 7.0.1
Encrypted: string(64) "HjktAT9wfjM1gTSbv+RDVoac51mgMEBXCIAhPYkN1ofzWFgwqIZrOd6aM668Qmc8" Decrypted: string(19) "hello this is demo "
Output for 7.0.0
Encrypted: string(64) "VHIM+8cdTMsbsFvM8Ryoc+fdzLMisO8fuEUPohqVCpPwxX48tZ5RQ8aKL7lx46Mp" Decrypted: string(19) "hello this is demo "
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/bMkW0 on line 8
Process exited with code 255.
Output for 5.6.20
Encrypted: string(64) "zTfEmkf1B8tZXMDQpWPwjHklJrky1eqIjLR0gxEg0GWIFpYL2bK2EAg5tcSMiUpR" Decrypted: string(19) "hello this is demo "
Output for 5.6.19
Encrypted: string(64) "k/2tcllburaT73hPRlfo6Tk75oXcAeh6ROfsDjVYDwp8tUUphovgFHaTPXcxK2R/" Decrypted: string(19) "hello this is demo "
Output for 5.6.18
Encrypted: string(64) "Af5qQV4drPUYc8kl62WQaGVmqcD+kGnwOCIxZP5F2fOeJjZ7gkcaE/3+RahEVJPA" Decrypted: string(19) "hello this is demo "
Output for 5.6.17
Encrypted: string(64) "O4GczyrCNoG3IdEmAtDIeGoCDk6ZCwwoR4w2NdtJEIcyZf2yGg6rww9xPNAWdiDD" Decrypted: string(19) "hello this is demo "
Output for 5.6.16
Encrypted: string(64) "rjYwIVDlj3sVTwCvLwNsoQxtss0Fu9qT9oDjcufBO14b6QLt2vn0CTYSw0IONVmA" Decrypted: string(19) "hello this is demo "
Output for 5.6.15
Encrypted: string(64) "peEbqX/Np3GQhYe4fpaqBYm4lj1OedmaIahyYEQCG5maMrX2nW854FYFeFMNIZAL" Decrypted: string(19) "hello this is demo "
Output for 5.6.14
Encrypted: string(64) "CpCCrv46uhBkhkICRqbEyPlaNLms8azDJ+prNIEBhlfRietakvEtWIsDiKhDAzpj" Decrypted: string(19) "hello this is demo "
Output for 5.6.13
Encrypted: string(64) "Q9T2eOTP5mEbeOgArAOX/xeuOrmtOnnno1hc4WK7RWsdY3jLcAva7UBEuFDxKoOw" Decrypted: string(19) "hello this is demo "
Output for 5.6.12
Encrypted: string(64) "4gl7YLpwXxJM44yTk84A7G2SKkoLgcsVb4+IkOYAvWdRBFyQECaR1jZZ8rJHmk52" Decrypted: string(19) "hello this is demo "
Output for 5.6.11
Encrypted: string(64) "KgCm8Gvmur9MFl789xoV9AzSwJJ7+3u6cNBV7BMzxe29sPbQNbrPaCDdU87UPBqS" Decrypted: string(19) "hello this is demo "
Output for 5.6.10
Encrypted: string(64) "vbOHCPyw8+jAKqAdO84gTMHtsxGVE0H0A8z7rFlRk9bMIYilbqPdnevb/Y6g37ru" Decrypted: string(19) "hello this is demo "
Output for 5.6.9
Encrypted: string(64) "5Qq+TzavtFpaZ7uDcaOD1+nCwQ8qOKUHzgsTGunEMc/Fu2I0gGtfHvAagvDs2E5t" Decrypted: string(19) "hello this is demo "
Output for 5.6.8
Encrypted: string(64) "LrTUgnWlLuwtoEye5x3VEI6RqNyi+iRRXmcGLwKpsbMGT6f5ry2w2EOK5GUDyYxz" Decrypted: string(19) "hello this is demo "
Output for 5.5.34
Encrypted: string(64) "tm1yq8RbZDv28u1MpbfAtBXcIO6BIG3cyjJBAefsJbi1rbU8anlhtK6qtKu0O438" Decrypted: string(19) "hello this is demo "
Output for 5.5.33
Encrypted: string(64) "o6q3mSsc0rTxxlJ79tZZEEw+BAqBPm4FOaYQM25/NbUpybBMcd5UjU0ATnOB8CWS" Decrypted: string(19) "hello this is demo "
Output for 5.5.32
Encrypted: string(64) "bOisCjLov37qR3/+D7dx+P2F5aFrnYZacoK/sNKDAtLIo4+CwKohuvwkXsKZXUgw" Decrypted: string(19) "hello this is demo "
Output for 5.5.31
Encrypted: string(64) "iHWxbgP0Par6k4V8wRtiTkS9W8HqRekMx+tKh9qLjb2vgCdGUgfOPwwpH5fwZhrn" Decrypted: string(19) "hello this is demo "
Output for 5.5.30
Encrypted: string(64) "S0dPTmXD8GusWK4oF0uzc4fgALRUExeAzkrYCs0jSovCLeHVPexczCavMses7pMY" Decrypted: string(19) "hello this is demo "
Output for 5.5.29
Encrypted: string(64) "s2R0N2eE///lcN8zMsKmsJ7VzDavis9cCSIYY4S6kC7JxzF7itGd5Yyb0dEXhBq8" Decrypted: string(19) "hello this is demo "
Output for 5.5.28
Encrypted: string(64) "0ENANcBQSj3cWu9qFzPIKnaCSHgA+VyYxin3pBkdpg12OO1dLpOGNVwe/c0pod8Q" Decrypted: string(19) "hello this is demo "
Output for 5.5.27
Encrypted: string(64) "4q0xzyK9XxN1HJUZR2heIOICejOtBLgtfEHWWtAXAZXFXh/QZqc9n/IzZc0ezZ+8" Decrypted: string(19) "hello this is demo "
Output for 5.5.26
Encrypted: string(64) "Onr0xM4mHuIEQPUCRP6CJkTIfoW2LhoJzhHXY4VMvgmllz9UBOjEYj53yjNJiK9q" Decrypted: string(19) "hello this is demo "
Output for 5.5.25
Encrypted: string(64) "ssS8wlm3TpndWOY1Lm08GtKk4422onY14cFE/zylzySpswTCY5uoxoua6KI5tcPh" Decrypted: string(19) "hello this is demo "
Output for 5.5.24
Encrypted: string(64) "F3HJ5H9RVM+nTwqf21aL2VV5cwh750XYRQObVeqB0gicFcsfiHMmBDFSZUGUV+xX" Decrypted: string(19) "hello this is demo "
Output for 5.4.45
Encrypted: string(64) "crqrKjF/227ueOmuLh/7XG268MCSZmoBVH0UW42L7qpMqMZS2kTr7Mp6nrC6W5Zi" Decrypted: string(19) "hello this is demo "
Output for 5.4.44
Encrypted: string(64) "9j77AqSilsfEYSa1ENyH4WtbZdL8pckwP8Frd7Zzu/KB7wjWVhLj3PJtzkLs15I1" Decrypted: string(19) "hello this is demo "
Output for 5.4.43
Encrypted: string(64) "LcGaXqeYC4cBctCzfvgOoqYSG8F5jRt/ZRzC8q+NxsDnvwqrGjA96VJKmNpyLERf" Decrypted: string(19) "hello this is demo "
Output for 5.4.42
Encrypted: string(64) "vVQFEinjgGiG5yQuSDnwU10IlLp4EjdhCH3ZmXOhIL7wUP+jv8eJCHLqUuZvlxfo" Decrypted: string(19) "hello this is demo "
Output for 5.4.41
Encrypted: string(64) "ss+BQ7KUFNg2oXilIvqgp9V1Bm4fojpXRyLXfQr4a80wHlChesT4h7F96uIx8Lme" Decrypted: string(19) "hello this is demo "
Output for 5.4.40
Encrypted: string(64) "xVXtc0O3722a3zdaZno2FqiT4sJlGqGeDYyFqErQSuOcnyS49a1fO8NnG4UVGI3D" Decrypted: string(19) "hello this is demo "
Output for 5.4.39
Encrypted: string(64) "HHmA5HRfPDQoIx9mqAXGyi4MN8dWt44mNRSE/VIEENs61IqzCg12dIUPSA8OgAhB" Decrypted: string(19) "hello this is demo "
Output for 5.4.38
Encrypted: string(64) "+VXisVFpjPpwAh/fgz/LGzIVJyoTxOtgNIi7MFJTt5iwBoqAlb6RSXs2N8jOAePl" Decrypted: string(19) "hello this is demo "
Output for 5.4.37
Encrypted: string(64) "oD0AzdpiMqgv+KOAB9f3dNC6LsAe71IXZAHYJZqp/N6uQPJqbFQfSVhdUEYrkAuX" Decrypted: string(19) "hello this is demo "
Output for 5.4.36
Encrypted: string(64) "NuJjPhntzbPna/kf0R4hVck4nDzHwFlcZDzH6lrUTJBI1bWfY2GHGirTi5trVFJL" Decrypted: string(19) "hello this is demo "
Output for 5.4.35
Encrypted: string(64) "SJZXuuR7DCGGEErwdxTQ2VDnlWx9seNWQzdfBxuHJ0ohvr16BqdUr+dQgnHK5Cro" Decrypted: string(19) "hello this is demo "
Output for 5.4.34
Encrypted: string(64) "7FHH22rmpB28kw6PWJp0gIG+5MX8NQzk6XRXXKxPd6Q0J5/sagpl+JrX6XnEmoII" Decrypted: string(19) "hello this is demo "
Output for 5.4.32
Encrypted: string(64) "Qa6viFuquEvwa5QsjAWC54Ki7EzG6gR8+qUw2Y/Jzgyf8mY8sogdgoi0KqFFFymN" Decrypted: string(19) "hello this is demo "
Output for 5.4.31
Encrypted: string(64) "LlM05UUFvtn0yIv4ezpVdjTbwxamdkJmo/FKbUvb30QzeHsbXOBGf034o3gLwwOz" Decrypted: string(19) "hello this is demo "
Output for 5.4.30
Encrypted: string(64) "veFBXnrDgu77sXk+nu+lcUcU3MIfc9VSJHVoLcQlSlQ+LC3VaThWFuptlN81le+n" Decrypted: string(19) "hello this is demo "
Output for 5.4.29
Encrypted: string(64) "jWmvOrGIW8aDvBklsJNloLheNyApA2Ns5CUKH5C1C6i+XeeiFQXdldSfYmNyD5SP" Decrypted: string(19) "hello this is demo "
Output for 5.4.28
Encrypted: string(64) "mUdW2mTLVDVtQIRLKQVqcx6U2tqs9oXj/TTz5xAhU2yL/Fw91mxo2dZQMWI5WL+V" Decrypted: string(19) "hello this is demo "
Output for 5.4.27
Encrypted: string(64) "Z0IL0/YM152Syw8phAyfrAVhcBJXVUz7UQwkFYkSM9cHVhWPkoV4tHuAVhZifk2g" Decrypted: string(19) "hello this is demo "
Output for 5.4.26
Encrypted: string(64) "Yc5XbcRdgWObeISW7TtV2o6dsKgWXSpnxL1tUNPFJtiYooDG0vmK1m0Ommlg3Vdg" Decrypted: string(19) "hello this is demo "
Output for 5.4.25
Encrypted: string(64) "GSpOF9vPpySI6FQCapSaqJ+APQ6Z4OQdYUieKDwppVPZ6EYzwLMaZk2RzDGgQalU" Decrypted: string(19) "hello this is demo "
Output for 5.4.24
Encrypted: string(64) "AVSbrJAxrzqOvXbGEOkXNYbmUUxlxk0I8NwgtmgWHi7SlgscA1sefR/J4I/kItKu" Decrypted: string(19) "hello this is demo "
Output for 5.4.23
Encrypted: string(64) "SSoUaSJ0zXSX6B6a+QYtUrHfREkAF1F4fDc6FHC7Rtqk3UnxWMd9m8M6vM6+eKgn" Decrypted: string(19) "hello this is demo "
Output for 5.4.22
Encrypted: string(64) "+qbHBAeAuXAsfMRHmScvVbg3sUvCDLFhRU7NTcd3Aungkn1dT8LGscmVF2ceTnQo" Decrypted: string(19) "hello this is demo "
Output for 5.4.21
Encrypted: string(64) "kYSUX3M9Yw0wR7rvLUBpYdxNJbX7m3PQNLICThdKutfphgmeZhsE90xNHGgnh+1P" Decrypted: string(19) "hello this is demo "
Output for 5.4.20
Encrypted: string(64) "s99n/JpQB/+JT6QVxCzW7n0amqjC8q6LpHWjKBUbKi6qb3pvMXeEW+Djuainjw98" Decrypted: string(19) "hello this is demo "
Output for 5.4.19
Encrypted: string(64) "okraxoKJp4E3ymg1t8KAlKOBDFIqMMVY/sKI5GX6ud9SsL25rOKtkGW0X5Qr0sXM" Decrypted: string(19) "hello this is demo "
Output for 5.4.18
Encrypted: string(64) "aaa1Wgf1SXB57hnvDwAUEb/vEBLJzsUmbeFTDfNbNaIqAUTLG6krDylyaz97UD+6" Decrypted: string(19) "hello this is demo "
Output for 5.4.17
Encrypted: string(64) "JyEQrzxHKC5E4FXhN7+ZgUdTbFEI2SyYfGgAxCOBlcaq9/idIwkG0eE7oBZTAKpM" Decrypted: string(19) "hello this is demo "
Output for 5.4.16
Encrypted: string(64) "vzEa1EfDUeeHY12sBumGnHvSzWtfcUBmKaTsG970OrJ8NbWN8gWj7nJhQ6swq8Gb" Decrypted: string(19) "hello this is demo "
Output for 5.4.15
Encrypted: string(64) "qz7i3PvmUTA1f0PX7mPS+Pl4A0pdlBhtc7Tl8goZ4Qr4xyRUrbBdFgOCQH0xn7WQ" Decrypted: string(19) "hello this is demo "
Output for 5.4.14
Encrypted: string(64) "9GSsx+fFgf5tIhQ/hHgLYKW17fKSzG3BbpWTViBY5CaC0DKenFxqsEB/ZEfw67HY" Decrypted: string(19) "hello this is demo "
Output for 5.4.13
Encrypted: string(64) "xBof02Shf3cSqgD5BDq/2LWXRKuj7pdKLHTS8nijNwxV5Y8sJLuYUsAT7T0+93LP" Decrypted: string(19) "hello this is demo "
Output for 5.4.12
Encrypted: string(64) "iR+8AzYThylcfc/zsmLFBSLV6FRpv4pHHuhraJm0GnMkBEoO0hmmUyUTER8uxljD" Decrypted: string(19) "hello this is demo "
Output for 5.4.11
Encrypted: string(64) "p74kCsaTjM4mTGCX1ZOxAzcAGBA7FVyUiBSBBxVyh4rZJzWH8KhZxDDRSVXBAwp+" Decrypted: string(19) "hello this is demo "
Output for 5.4.10
Encrypted: string(64) "SBxEDt9zHwNgEOkUwDm3jfBprz2UlDYtPlA6NmJ8iKxHVDCCk/8aVYe0Y3M5VX5W" Decrypted: string(19) "hello this is demo "
Output for 5.4.9
Encrypted: string(64) "+kzWGUAtgksrJX/zcVMe2IPJIXBhLx8NKOLwSgn7RyVg5olpV0T5ZYu0dlp+icCt" Decrypted: string(19) "hello this is demo "
Output for 5.4.8
Encrypted: string(64) "hdrj2QS58wY4rywB/K/w3icHHtrmPL1+wPkwzRrv8Rt83eqIkGQ5rvqRZ3rDXdOn" Decrypted: string(19) "hello this is demo "
Output for 5.4.7
Encrypted: string(64) "r+ZJX4072BD5Sm0UiGnsa//oiBJKOFdeSJ7C0jcNqyREd5UI5trCC2SCjGGXc/+g" Decrypted: string(19) "hello this is demo "
Output for 5.4.6
Encrypted: string(64) "u5G1yQo2FymwXWrAZridHXepHg/F9oJWm+qfviH7aLM/lT0CMWo8Fr7f1bQ9ET3j" Decrypted: string(19) "hello this is demo "
Output for 5.4.5
Encrypted: string(64) "0UxxtLiblhwzWy8JMkyrUITuI0YJ0UOWA+FiFZib4u0Bf9SYZTOCIZlG8fcqvJTz" Decrypted: string(19) "hello this is demo "
Output for 5.4.4
Encrypted: string(64) "UZ6KdGUjxPyT2McvALpQmwvw71ovkwW2l4Z633TQcDMj4WJ64FVF1RqJ2+Ddeoxe" Decrypted: string(19) "hello this is demo "
Output for 5.4.3
Encrypted: string(64) "EsTYEUuAjOVSMFZOJ7/XqhxwwPH4urnSH/Eadaxv/l34wvdhD7RWF5QypbXJGkid" Decrypted: string(19) "hello this is demo "
Output for 5.4.2
Encrypted: string(64) "Mv4rpHbL45NKUrn64FTNtyI0PSraSJNrSLnArNT7rMXOl1bSZrNKC60pzgMv9dLw" Decrypted: string(19) "hello this is demo "
Output for 5.4.1
Encrypted: string(64) "n0IJ0IFxJa4QrshI5rKrnTRwNGmklk7oi+brhOHAlrAaDX46shBN9/uNy7rT61PT" Decrypted: string(19) "hello this is demo "
Output for 5.4.0
Encrypted: string(64) "Va91+vgNqilrZ4cYrpbAMeFhbKeeMvy60eO987R3xSpEHb+5I9XCzBGAUYWc8fwh" Decrypted: string(19) "hello this is demo "