3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php $key = 'password to (en/de)crypt'; $string = ' Nov123 '; // 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.3.0rc4
Fatal error: Uncaught Error: Call to undefined function mcrypt_create_iv() in /in/6uuHE:8 Stack trace: #0 {main} thrown in /in/6uuHE on line 8
Process exited with code 255.
Output for 7.0.5
Encrypted: string(44) "pyreThQR7cGqPFQyHvz9GBy/phnWS0+VH2YCO0fbJFs=" Decrypted: string(8) " Nov123 "
Output for 7.0.4
Encrypted: string(44) "JdRNBFO0uBUAdzwCDTijL4cKBi5rDkdEqJnMJnG/iZI=" Decrypted: string(8) " Nov123 "
Output for 7.0.3
Encrypted: string(44) "04R/UpEKsRYIw9e25QKSxXdbwUVEuoGPKQpWht1OAk4=" Decrypted: string(8) " Nov123 "
Output for 7.0.2
Encrypted: string(44) "jLwaLja3Fd7Dq7riNlaW9pIOp0zoY48KG6qHw3oENjM=" Decrypted: string(8) " Nov123 "
Output for 7.0.1
Encrypted: string(44) "MUxWDFov1WS/Brsw/mFrS0mjzIOi1AyIFiWVQAwqSn0=" Decrypted: string(8) " Nov123 "
Output for 7.0.0
Encrypted: string(44) "J/rdbmAPVDrERtblRTSOPgAn0Bb78o+R7xnBvM41Il4=" Decrypted: string(8) " Nov123 "
Output for 5.5.35 - 5.5.38, 5.6.21 - 5.6.28
Fatal error: Call to undefined function mcrypt_create_iv() in /in/6uuHE on line 8
Process exited with code 255.
Output for 5.6.20
Encrypted: string(44) "Zens1jBNO4VB1DXw8d+DIdbE2YJz3bkE/HRDkbeOWoc=" Decrypted: string(8) " Nov123 "
Output for 5.6.19
Encrypted: string(44) "9hCHQY0zQ/cIzhlKFblSAhEQKO63VpCW48/f8qn2lLA=" Decrypted: string(8) " Nov123 "
Output for 5.6.18
Encrypted: string(44) "p4bw0S0asqR3f53BkpxgxQ+OB8L8AK1MgAP8JeN26/E=" Decrypted: string(8) " Nov123 "
Output for 5.6.17
Encrypted: string(44) "+jw4FK3PR3ngHpWy6zq6z1M4jm9qnqO3sGLEyC10LIw=" Decrypted: string(8) " Nov123 "
Output for 5.6.16
Encrypted: string(44) "s7G6KrIHCMIkG3Q8ysJK7RYYjkTdOla17EAp4JDjoGY=" Decrypted: string(8) " Nov123 "
Output for 5.6.15
Encrypted: string(44) "O/QmnePvz5qICMas4jyBQOTV4M0T4ipgBFc0r3XZmAw=" Decrypted: string(8) " Nov123 "
Output for 5.6.14
Encrypted: string(44) "GS5uwIrDRU9/dVfV9ZVqguEfC27U70Stu27gbC35fGg=" Decrypted: string(8) " Nov123 "
Output for 5.6.13
Encrypted: string(44) "iHCFdSoU8nQ/y4W4pIk5bekoOub1hteFNZZBasiIJBk=" Decrypted: string(8) " Nov123 "
Output for 5.6.12
Encrypted: string(44) "oPEBsyzn3iafXvHeLbWIRqnLWDScsk5sEw7eaB0cqbg=" Decrypted: string(8) " Nov123 "
Output for 5.6.11
Encrypted: string(44) "runK1+zeKO9rlAGWa+adPg5oJdCLXcEPFvGGSU6FVKw=" Decrypted: string(8) " Nov123 "
Output for 5.6.10
Encrypted: string(44) "D+bwpy0l0xBL4Tb75MELD0FJgZY57xu/+hoPQPY4D0Q=" Decrypted: string(8) " Nov123 "
Output for 5.6.9
Encrypted: string(44) "lpoUGasfLC8eY7FLpyz4Z3FOn0FXW8MRj4XKNpm3SlY=" Decrypted: string(8) " Nov123 "
Output for 5.6.8
Encrypted: string(44) "KvLG8hIMisR+6LSvwBheVYpEE6qEtL9rM15PF+DsBM0=" Decrypted: string(8) " Nov123 "
Output for 5.6.7
Encrypted: string(44) "K1nfBuzQIM6jNuVuQwgc7pGe0YRXb6AOcto790pqMK4=" Decrypted: string(8) " Nov123 "
Output for 5.6.6
Encrypted: string(44) "h/Se21IgEnHynsyQesEZhPgi4sBBDXSjEYOIOikqIAE=" Decrypted: string(8) " Nov123 "
Output for 5.6.5
Encrypted: string(44) "2O3OOtqmGptUhNOYpt4K9p1ydGX8jZw0CLN0XBq+a2Y=" Decrypted: string(8) " Nov123 "
Output for 5.6.4
Encrypted: string(44) "t1NTfnMCcwj/oJPBR250GRmQR/EPk7uMrwE+FtuKObU=" Decrypted: string(8) " Nov123 "
Output for 5.6.3
Encrypted: string(44) "Pckny03xWG4cLxNdJMC4GdDrxAunIAN5Pq/SiUxjP8k=" Decrypted: string(8) " Nov123 "
Output for 5.6.2
Encrypted: string(44) "tDNJfd6nnljTeo9gmHD62wYGQFBQ7V1S4H95WvojAW0=" Decrypted: string(8) " Nov123 "
Output for 5.6.1
Encrypted: string(44) "i0SxrYnKqselVbBUKgC+ewAtSgPlEzNC/22Dbd/9FNE=" Decrypted: string(8) " Nov123 "
Output for 5.6.0
Encrypted: string(44) "EVO0qU/C0zz3sUvGvaesdUQNh+Fd7EF0q8Qgm0hAHB4=" Decrypted: string(8) " Nov123 "
Output for 5.5.34
Encrypted: string(44) "tP+eJ/Xuahh+s5hQwDNEEC4MVREKnqWNtQsqHwIzSRc=" Decrypted: string(8) " Nov123 "
Output for 5.5.33
Encrypted: string(44) "xdrloG6hQ2VtXTFOkmLcaRiZTClLp1Db2oXwmAoDUik=" Decrypted: string(8) " Nov123 "
Output for 5.5.32
Encrypted: string(44) "9Sk3s/m4hfoBE7Fgc3S4lHfHIXT4gqwK9vhlRJNktEg=" Decrypted: string(8) " Nov123 "
Output for 5.5.31
Encrypted: string(44) "GYKnW8vbnOVkWrNuKyldp+9Z5VGSkWrXT98YKOb/B3g=" Decrypted: string(8) " Nov123 "
Output for 5.5.30
Encrypted: string(44) "5Y4SahpTuhVoYoE58pObN8C6L5rTF7gWKzjO+Lm4Nxw=" Decrypted: string(8) " Nov123 "
Output for 5.5.29
Encrypted: string(44) "uzELQWW+rVrROACDoscw92vK4pKgXfBh3MuibR0FvgM=" Decrypted: string(8) " Nov123 "
Output for 5.5.28
Encrypted: string(44) "4GN7NW1Jq11fdyGP//YoHg/2kzR5QeiqUu7ZlXycd6I=" Decrypted: string(8) " Nov123 "
Output for 5.5.27
Encrypted: string(44) "Q98jB0Ifl+89tAnAzpF0sn1kpkBzHxYE+QnFZnt2Zts=" Decrypted: string(8) " Nov123 "
Output for 5.5.26
Encrypted: string(44) "1Ia5x8DvZdAKhVukHxpLFZVREud0VQUbWmxJFBab/mA=" Decrypted: string(8) " Nov123 "
Output for 5.5.25
Encrypted: string(44) "tr3C3+9tZYpy1pFvOgYhOqkgUOyjzpbnYWSSmP5igis=" Decrypted: string(8) " Nov123 "
Output for 5.5.24
Encrypted: string(44) "Aw8QwgmDyWKllKDIa5RsPdteKHMQ19ONy2/N9Yi5xZQ=" Decrypted: string(8) " Nov123 "
Output for 5.5.23
Encrypted: string(44) "SlEX4ba7/cFryK7yvnssYrRh7QpWm9hXXoCcqLeqmT8=" Decrypted: string(8) " Nov123 "
Output for 5.5.22
Encrypted: string(44) "Z4qEmbY+gML/zNWEsRW/ShecZAyiQqIrOcuP2YGvqUs=" Decrypted: string(8) " Nov123 "
Output for 5.5.21
Encrypted: string(44) "4HjAWZq76xpLR97frMlvhzN3TYPTFpf/8KHgzZgtiFM=" Decrypted: string(8) " Nov123 "
Output for 5.5.20
Encrypted: string(44) "vD54Nh4c34EkcGqRYCm70zrXWPzbOl8Ic8lRwz39qGI=" Decrypted: string(8) " Nov123 "
Output for 5.5.19
Encrypted: string(44) "KGSjZu6jjEAWr58ChxAFWkkj8lBfgWHvdnb+1fBmLn4=" Decrypted: string(8) " Nov123 "
Output for 5.5.18
Encrypted: string(44) "54w2WEMeDuAREz9SOOtvelpYgLguA7A1mYb8cidCzn4=" Decrypted: string(8) " Nov123 "
Output for 5.5.16
Encrypted: string(44) "AyfKm4tmEu4htUCZlGfXt6kcEBC7E2OOPEYtWAcFlNk=" Decrypted: string(8) " Nov123 "
Output for 5.5.15
Encrypted: string(44) "yWlq+8OQMqbuS7zEnCaTkOt1P6TPRut4mSRGaT7k6D4=" Decrypted: string(8) " Nov123 "
Output for 5.5.14
Encrypted: string(44) "fy14kA0Occ4tCqrb+APUMdHTX7nF1ENayRycyx6vS04=" Decrypted: string(8) " Nov123 "
Output for 5.5.13
Encrypted: string(44) "Ft3+xMRnEU1KHIlhGtdAXifvROm8QyvVHEla26M2rIw=" Decrypted: string(8) " Nov123 "
Output for 5.5.12
Encrypted: string(44) "YsRqjHSzM/RJ9/+SCQkB0d5/aSkekaxQT+0eCcsj/wo=" Decrypted: string(8) " Nov123 "
Output for 5.5.11
Encrypted: string(44) "j7gnxzz2pqwkToEAeJQCX6NN5S5o1M4++53OMWFQ2xU=" Decrypted: string(8) " Nov123 "
Output for 5.5.10
Encrypted: string(44) "7Kq3AQg6bl/N/Dtpi3D1s+K/zg/KwB3J3QsfBfMRTUM=" Decrypted: string(8) " Nov123 "
Output for 5.5.9
Encrypted: string(44) "7RPFqZSwVN/DNvpqQpeNt7ghJprB1Tlfyj6FctxvNQM=" Decrypted: string(8) " Nov123 "
Output for 5.5.8
Encrypted: string(44) "fqLzJqFJnOca7SwnupfwIDuQ9tfQIN4KD1i/sHl82fo=" Decrypted: string(8) " Nov123 "
Output for 5.5.7
Encrypted: string(44) "Q5yzFnw7duJHJuaX5ub+qTL8Kb7umntZ7F1iR97VYXg=" Decrypted: string(8) " Nov123 "
Output for 5.5.6
Encrypted: string(44) "KV0cNRUFBG2S2Q6pJ50+D2ZNeNAN8HmwT4yur6F4BoM=" Decrypted: string(8) " Nov123 "
Output for 5.5.5
Encrypted: string(44) "oLz5faFWPnAIYy3E6gBIq5JfwMqhd3ujbGD8AQCFfX0=" Decrypted: string(8) " Nov123 "
Output for 5.5.4
Encrypted: string(44) "Uf+t07R0xg+OhRhdZP89V6CDL2Q52Nt0KSK9NDoQqWI=" Decrypted: string(8) " Nov123 "
Output for 5.5.3
Encrypted: string(44) "fo9IrdBBKSj6qXfpamZAppbsA7ExekjnM9ZrHVzJg9o=" Decrypted: string(8) " Nov123 "
Output for 5.5.2
Encrypted: string(44) "6wRD7qQc4ieAR+wiNTk/Mgu30nxwRTeT598aAc+dSUI=" Decrypted: string(8) " Nov123 "
Output for 5.5.1
Encrypted: string(44) "tQ5/msftcIOWYsdYQhWTX+rZ2Nc85mCMGMibvpMCqac=" Decrypted: string(8) " Nov123 "
Output for 5.5.0
Encrypted: string(44) "7fb4Eug0BXCumuKgUhpFXExvTBfRSGQ6XXyYUh9Gvuk=" Decrypted: string(8) " Nov123 "