3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php $key = 'password to (en/de)crypt'; $string = '1394010100100'; // 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/6k67Z:8 Stack trace: #0 {main} thrown in /in/6k67Z on line 8
Process exited with code 255.
Output for 7.0.5
Encrypted: string(44) "s1pVdSmQVGbsYgZpeWxxHPfufA6gvVgoNsZ97PQbcCM=" Decrypted: string(13) "1394010100100"
Output for 7.0.4
Encrypted: string(44) "Qw7zch/vv9M34TAA5jdVQVYGUA/xlIaVdI/Hshmyeks=" Decrypted: string(13) "1394010100100"
Output for 7.0.3
Encrypted: string(44) "xBiv4+NZUpS06DL4zvUiGA+wG9GnzZOjbSjj+np/CaM=" Decrypted: string(13) "1394010100100"
Output for 7.0.2
Encrypted: string(44) "tdt7XR/wQk+lnYgD6gCqmYJ5JTJ9DsPIjsMX7AV97Is=" Decrypted: string(13) "1394010100100"
Output for 7.0.1
Encrypted: string(44) "VRwqP2UepnAXklNlrkOCkiYkBZg+T8bcSn7cm/YK5tc=" Decrypted: string(13) "1394010100100"
Output for 7.0.0
Encrypted: string(44) "03t7nSKBbnIQHaD+1go7lxExNMHMF+xPwjxnEToHYaM=" Decrypted: string(13) "1394010100100"
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/6k67Z on line 8
Process exited with code 255.
Output for 5.6.20
Encrypted: string(44) "8hB2+vxPDHTZzrnO2Qdgia3ZJZvLW21BKfxPOgoS288=" Decrypted: string(13) "1394010100100"
Output for 5.6.19
Encrypted: string(44) "ZYwLf9dQGKQ3VNapqIE/vJkTT4NDj5uI/A6qPwgn5qU=" Decrypted: string(13) "1394010100100"
Output for 5.6.18
Encrypted: string(44) "/QQS9dqXSRvi0G5cLJw0XOiZN+BnuqPlRmdiH9/tC9o=" Decrypted: string(13) "1394010100100"
Output for 5.6.17
Encrypted: string(44) "6QQWz0tXY5qQEiZtG9Cbt924DAggWK85j61Dmk5kDlg=" Decrypted: string(13) "1394010100100"
Output for 5.6.16
Encrypted: string(44) "KN0ojQGgptnCqPpbqw+vxcJ8Sm/DRHz8VQwnf0hYM8Q=" Decrypted: string(13) "1394010100100"
Output for 5.6.15
Encrypted: string(44) "V/9L3y3AaViQ+uO+C6yn1Eja1lUYvz0ZSwecqWZJfTA=" Decrypted: string(13) "1394010100100"
Output for 5.6.14
Encrypted: string(44) "nfWmbqRwsnZV0UDeWr+7NnGflybUTklzZquDkVI72I0=" Decrypted: string(13) "1394010100100"
Output for 5.6.13
Encrypted: string(44) "hGU9QEU5AY91E70jFHII82F9qZlvqWQpWfUV4SG7R4o=" Decrypted: string(13) "1394010100100"
Output for 5.6.12
Encrypted: string(44) "lvkb9PmtFtx5DqoQPvyPrY18fhOnuTxG98CVWTbOdvw=" Decrypted: string(13) "1394010100100"
Output for 5.6.11
Encrypted: string(44) "xstiWEvFr/hB6TUWWarwBdHRXkCJUDr1ZASf78mnsjQ=" Decrypted: string(13) "1394010100100"
Output for 5.6.10
Encrypted: string(44) "Nl0SmDHwGbsV0OTKgL9Fq72PPJiaI2RVmm/Bm5JoB7Q=" Decrypted: string(13) "1394010100100"
Output for 5.6.9
Encrypted: string(44) "QrV030viTWJVhVWg422cQT+vCVPOqOw7OSak5JAvDTo=" Decrypted: string(13) "1394010100100"
Output for 5.6.8
Encrypted: string(44) "7m1Sn7gUwSXKEpkqU09FLsApo6c+hellZanPiyGnTfg=" Decrypted: string(13) "1394010100100"
Output for 5.5.34
Encrypted: string(44) "tQvSD52/t80MWTJM07MIwRRRv01AY5IG7YFTpyVX7nk=" Decrypted: string(13) "1394010100100"
Output for 5.5.33
Encrypted: string(44) "zl+ymfnQHnfuLB+x+WvGYN3RwoSXMdt5NbOVJhcpCRQ=" Decrypted: string(13) "1394010100100"
Output for 5.5.32
Encrypted: string(44) "xF7ivqOWyCoYjaVsd/37JzdNragSV5DSL8UFBEcT8Cw=" Decrypted: string(13) "1394010100100"
Output for 5.5.31
Encrypted: string(44) "9pVLn7EuPcP9LL/gp5WvTHMGHCv1QRb0lJ/NO5euptE=" Decrypted: string(13) "1394010100100"
Output for 5.5.30
Encrypted: string(44) "Ee8YZy7kLX87oVvzVzbmygk4cYgVfWGxIl3TPUPNjAQ=" Decrypted: string(13) "1394010100100"
Output for 5.5.29
Encrypted: string(44) "0QNYp8nsqcq7wMb4mFMUPVJuMojKvHU1rOX465mSFMY=" Decrypted: string(13) "1394010100100"
Output for 5.5.28
Encrypted: string(44) "bgYdELWLmpRAOCZ8kDYslOJPX8ggTZuIqecuyF9pdS0=" Decrypted: string(13) "1394010100100"
Output for 5.5.27
Encrypted: string(44) "K4aclUDqbHjHYK7Aj2fwPjTL/CGdBv/rcIHIcAxZwxo=" Decrypted: string(13) "1394010100100"
Output for 5.5.26
Encrypted: string(44) "8cyU5q/DMb+IR0trqlWQuIDnbIOD8SaXGtLUYkkguX8=" Decrypted: string(13) "1394010100100"
Output for 5.5.25
Encrypted: string(44) "zl+Hw3G2mAxe0YIuKI2007Tcekz8SmdRSmmrzsNr2So=" Decrypted: string(13) "1394010100100"
Output for 5.5.24
Encrypted: string(44) "nI9UF7+m29/qAUajF4Op+xEYQEJwrjZKMmJRZh0Q61o=" Decrypted: string(13) "1394010100100"
Output for 5.4.45
Encrypted: string(44) "TIM1BK1zy0rJiKXb6uVokj6o+ir/ZXTjv+5duylrOhU=" Decrypted: string(13) "1394010100100"
Output for 5.4.44
Encrypted: string(44) "A8SMyXxf5gC+TqUIGaizTH2VoBDoe1AVynsTfkcRAd0=" Decrypted: string(13) "1394010100100"
Output for 5.4.43
Encrypted: string(44) "C7HwmQfB2SAimulHp/LQ138sq4fa0FKmtHAdlQu9W54=" Decrypted: string(13) "1394010100100"
Output for 5.4.42
Encrypted: string(44) "M66miG0En9Ndcw1vdnhYHB5vAjALEECSpUaYYSuM53o=" Decrypted: string(13) "1394010100100"
Output for 5.4.41
Encrypted: string(44) "m/ZO0wKe49Fqv/cOk+socrQlOzEd3M+k2DxMUbWpul8=" Decrypted: string(13) "1394010100100"
Output for 5.4.40
Encrypted: string(44) "mgztEZuJU/DrCbp4T9Eu+PXnmdLGNl9PTLrfFymB0hE=" Decrypted: string(13) "1394010100100"
Output for 5.4.39
Encrypted: string(44) "aXPviyWqsOOaodDdmQgVBehKQfQbPSS3Vhdwc630NrY=" Decrypted: string(13) "1394010100100"
Output for 5.4.38
Encrypted: string(44) "tnXtp0ss25ERAhvecNU6eDa6X7B+i1bOZSQiNoFWmDo=" Decrypted: string(13) "1394010100100"
Output for 5.4.37
Encrypted: string(44) "Hjf5xHvDvJnauupjFNBxDMf2BnuXVb3MJyEOr3G+96g=" Decrypted: string(13) "1394010100100"
Output for 5.4.36
Encrypted: string(44) "am7gGtb6z3f9VDhPJm9pO2Uk7szmqE/bwr1kg5OZSsE=" Decrypted: string(13) "1394010100100"
Output for 5.4.35
Encrypted: string(44) "uwJhQJQS5DHrWfffLwK40bmILCG48zyS2j6tYfR5wWw=" Decrypted: string(13) "1394010100100"
Output for 5.4.34
Encrypted: string(44) "VwBfT4ImlZ69MXPtn5+8EZ2aOoKyHZhenXSSquucElI=" Decrypted: string(13) "1394010100100"
Output for 5.4.32
Encrypted: string(44) "ws8zRFVJkyorXvFjVinA+NsKuscA2Nl92Kcdxf7JGPQ=" Decrypted: string(13) "1394010100100"
Output for 5.4.31
Encrypted: string(44) "uoWIygfSsC1wtI1Erp9fu/thkC6aodvE3Wymvk7pHEw=" Decrypted: string(13) "1394010100100"
Output for 5.4.30
Encrypted: string(44) "Ug0WJJMMJeKlkHfBzokfDSynTRdX3r1kgtcpc5Yhfyw=" Decrypted: string(13) "1394010100100"
Output for 5.4.29
Encrypted: string(44) "5/LV7NG4niC4MFvKs5z6kZp2boqzQLqPByxdbNFPxQ4=" Decrypted: string(13) "1394010100100"
Output for 5.4.28
Encrypted: string(44) "GlL9cfg54DyGqOsjX2KCot2Hlq3jdB9mgEDw9yd8Vww=" Decrypted: string(13) "1394010100100"
Output for 5.4.27
Encrypted: string(44) "oBnrr1ppd/Io5SMF2tDkd+H9M/zufltKtL/GPN5wG/M=" Decrypted: string(13) "1394010100100"
Output for 5.4.26
Encrypted: string(44) "wfuvyescpiAJaG+07TrSyDaFRQ+XUPRMLaBLyU49UFM=" Decrypted: string(13) "1394010100100"
Output for 5.4.25
Encrypted: string(44) "cJZvLa6ScQ+ifp8J1/NXLNXmIBGO3TMAunAPuME7eI0=" Decrypted: string(13) "1394010100100"
Output for 5.4.24
Encrypted: string(44) "/RaXSCOjrva9CbLPF7xQRNpRAkATqN7Okt+G8IdghgU=" Decrypted: string(13) "1394010100100"
Output for 5.4.23
Encrypted: string(44) "bDoQmTXxp2PCKEYyIb0o0HJtAmUwEkoRgy3H9ZgCdxM=" Decrypted: string(13) "1394010100100"
Output for 5.4.22
Encrypted: string(44) "1i5AYmj6bUTvWeh7ItHhwIdqzgYCUZCTXHbBNL9L+V8=" Decrypted: string(13) "1394010100100"
Output for 5.4.21
Encrypted: string(44) "8QRo3bxCCJeZEkms5V+lrqoT2OmYKTOCUGSa8mP+zmQ=" Decrypted: string(13) "1394010100100"
Output for 5.4.20
Encrypted: string(44) "YHV4XK10zu11Rw9xm62Iy++5Mf5zJ2Kyv+JBfyfdVNw=" Decrypted: string(13) "1394010100100"
Output for 5.4.19
Encrypted: string(44) "ZAWSTtVKeFfSBTs8tJ7BTFJtkcKFss9e7K57lH0+/G8=" Decrypted: string(13) "1394010100100"
Output for 5.4.18
Encrypted: string(44) "/PwVUfzujC7VxAa84ztGSYTdKNAEfG+SXkVAVL/GEso=" Decrypted: string(13) "1394010100100"
Output for 5.4.17
Encrypted: string(44) "9xWwCebfITNKcgph2s6GHfhti/aUctqh7Bhkz0wA2uY=" Decrypted: string(13) "1394010100100"
Output for 5.4.16
Encrypted: string(44) "oaPbjQ/Qnhn94c1qLUMuUqDGSKsw0RylyVKLJMtIfig=" Decrypted: string(13) "1394010100100"
Output for 5.4.15
Encrypted: string(44) "gGA8CaxM3ye079DY+7K4zlw1nmWGyscZ+YZda2VDqrY=" Decrypted: string(13) "1394010100100"
Output for 5.4.14
Encrypted: string(44) "81K7ICxR7VVT7PyDwy4uS1wAOzJgSddxYM/CeHJM6Ms=" Decrypted: string(13) "1394010100100"
Output for 5.4.13
Encrypted: string(44) "5jPqJpZqctpdqIZaFdhDDPyyEEl7hngiRuhxmM197lg=" Decrypted: string(13) "1394010100100"
Output for 5.4.12
Encrypted: string(44) "CToYWCPEosZ9E0zXvTrQ4ghGVpA7OBQRSyu07ESWBtU=" Decrypted: string(13) "1394010100100"
Output for 5.4.11
Encrypted: string(44) "Yr1YCXX2gKqk9SH9M700lXtLA3rkRyGNJjwyswb3Pyg=" Decrypted: string(13) "1394010100100"
Output for 5.4.10
Encrypted: string(44) "uKQdop8EikkQuYguKyoKKj7iNsEVyUSktpfBFD6prZI=" Decrypted: string(13) "1394010100100"
Output for 5.4.9
Encrypted: string(44) "VTcU5Xcpwwfrzoz4/7/Dbl8V7ug9aVlQbBXnb5r8tgE=" Decrypted: string(13) "1394010100100"
Output for 5.4.8
Encrypted: string(44) "JkGAirYJ1HbeJRMq2MmNAyiuRQRFArUIPqANSRfQM3k=" Decrypted: string(13) "1394010100100"
Output for 5.4.7
Encrypted: string(44) "S3ei1VA9FB8mwi+bRaJbYtZF+f1JuM6nuR1hqvBP8W8=" Decrypted: string(13) "1394010100100"
Output for 5.4.6
Encrypted: string(44) "zwcJ7m01aC7/IOxsPDODT28JSakhKLgWUnlvOW4jcqQ=" Decrypted: string(13) "1394010100100"
Output for 5.4.5
Encrypted: string(44) "RAvGzWX8TiLlxjC7+J8zEym539MMJzzmd30KO94XccI=" Decrypted: string(13) "1394010100100"
Output for 5.4.4
Encrypted: string(44) "3mzttAKEcRriI/iBohQjJnn2fuH+r8Lqs2wz7+VPHTs=" Decrypted: string(13) "1394010100100"
Output for 5.4.3
Encrypted: string(44) "Vf6P9/Nau61qTuyTJQH9880AQXhVDY724/VpxJS9NKI=" Decrypted: string(13) "1394010100100"
Output for 5.4.2
Encrypted: string(44) "2N3qCeBMWx3kVIR6/F/BjwPybx31u2nW1vyNBm8irAg=" Decrypted: string(13) "1394010100100"
Output for 5.4.1
Encrypted: string(44) "Fchw5GbXPyFfvfFt+/4Sue7xyTmRxp6RMGfZg66PkgA=" Decrypted: string(13) "1394010100100"
Output for 5.4.0
Encrypted: string(44) "j7V2hVKsbs8AYX4y0DDWrzshVwTGgqDi6BwWVv5+4j8=" Decrypted: string(13) "1394010100100"