3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php $key = 'password to (en/de)crypt'; $string = 'tesr'; // 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/YiCYK:8 Stack trace: #0 {main} thrown in /in/YiCYK on line 8
Process exited with code 255.
Output for 7.0.5
Encrypted: string(44) "PM2OF82IR6VsiINx7sU9T4ZgQ+ocmpWfAg0utVPs5Js=" Decrypted: string(4) "tesr"
Output for 7.0.4
Encrypted: string(44) "7/DbDUIQyYYsCBlyALLOBAP1XMuDaxHjhLAOw6av9S0=" Decrypted: string(4) "tesr"
Output for 7.0.3
Encrypted: string(44) "FyvyYqTxgVusNpaMp9c0MLspFTZnmflL95BhcCLtJvM=" Decrypted: string(4) "tesr"
Output for 7.0.2
Encrypted: string(44) "vXhd6iMSMtRVSwUhFayoeuMiArYb4FRqHSkn6oWJ8tk=" Decrypted: string(4) "tesr"
Output for 7.0.1
Encrypted: string(44) "//30vp9K4gYIabYhU4FBNAWaQizF+oDfK1RNXc4XA0M=" Decrypted: string(4) "tesr"
Output for 7.0.0
Encrypted: string(44) "Vr+Eg9F9mmHkcL/1R++238IxrO7ki7y3qX19vrjTIf4=" Decrypted: string(4) "tesr"
Output for 5.3.21 - 5.3.29, 5.5.35, 5.6.21 - 5.6.28
Fatal error: Call to undefined function mcrypt_create_iv() in /in/YiCYK on line 8
Process exited with code 255.
Output for 5.6.20
Encrypted: string(44) "gyr/XmOsxQmy9dLYWXUp3BEY7CSVkb7OYMX3PcTXhk8=" Decrypted: string(4) "tesr"
Output for 5.6.19
Encrypted: string(44) "4Y3LsWLuHsuW2QikISBFGvDLuw1E4mjwsSrDUSSukwA=" Decrypted: string(4) "tesr"
Output for 5.6.18
Encrypted: string(44) "e4CkjibuJM4CZ/A5r+Ilx9l0lfolPE+GXmBRscZIBmQ=" Decrypted: string(4) "tesr"
Output for 5.6.17
Encrypted: string(44) "dGtjaSRr1PuBeQC14dYO7xNp3DaQJZhUMP7oA0aXGIs=" Decrypted: string(4) "tesr"
Output for 5.6.16
Encrypted: string(44) "ruJDzBoKvHTrZucrHZrOnpeQvmfaPaGmtjIdTzuEH/I=" Decrypted: string(4) "tesr"
Output for 5.6.15
Encrypted: string(44) "GGZuAEcvGY4GbTo0bmgsOOLpMtdCqZX23ifAcqpMSEo=" Decrypted: string(4) "tesr"
Output for 5.6.14
Encrypted: string(44) "OfHIgZ9VEsMevwf5x0ji4yyfkTnJkxtCCGQhTdvpRZ0=" Decrypted: string(4) "tesr"
Output for 5.6.13
Encrypted: string(44) "81yQVaSgpjeMuq8+BpQJnz7FVFzwO3aZ7DzgASK5Lk4=" Decrypted: string(4) "tesr"
Output for 5.6.12
Encrypted: string(44) "CmqzaZPOIBJe+IdakTjiNhfMpWOBCobLBBrzk465ua8=" Decrypted: string(4) "tesr"
Output for 5.6.11
Encrypted: string(44) "koT1t8a6Nfoy/Y4aR008xoLzhjBAaJqnEvGuXxpAkMU=" Decrypted: string(4) "tesr"
Output for 5.6.10
Encrypted: string(44) "CT/4FtoOpcnSaAvRv8a7Qayff8T8DGzTEFEvy+wgcUs=" Decrypted: string(4) "tesr"
Output for 5.6.9
Encrypted: string(44) "oRsI9c3YsYRoBAI6I6tX24L8TLQB4iMHmqepS8T7zUU=" Decrypted: string(4) "tesr"
Output for 5.6.8
Encrypted: string(44) "rdutqb5Xv+aiFAQIgTQX9Bw0eeI6pZXaBcJPeldofqg=" Decrypted: string(4) "tesr"
Output for 5.5.34
Encrypted: string(44) "o7nFVfWlzBDIGH7X58dP1hBCNgr3vF5NsisU/UaFSOM=" Decrypted: string(4) "tesr"
Output for 5.5.33
Encrypted: string(44) "aOE7jBtqJvP72UVUem0kiDbsaUs/2eoNDvQGEkECsYw=" Decrypted: string(4) "tesr"
Output for 5.5.32
Encrypted: string(44) "ohXOY1lgpbqJczmGlbPg4u8SGLgd6vqYWq+kn1qi14k=" Decrypted: string(4) "tesr"
Output for 5.5.31
Encrypted: string(44) "ecu/KCvDJsKXBeOGQgN5XoTRZXQdwe7NoPqwCSnMeWM=" Decrypted: string(4) "tesr"
Output for 5.5.30
Encrypted: string(44) "Zw7qbVC6DmJoP+wJWwNHK/bHFALz64qyRVwBxvcJET0=" Decrypted: string(4) "tesr"
Output for 5.5.29
Encrypted: string(44) "HDR3D1t7Er3MyZA07YBzU3BvDQ9J6H1SBX2FSCu1C/s=" Decrypted: string(4) "tesr"
Output for 5.5.28
Encrypted: string(44) "ljNWm72vQXEIreFJJdAY5XkBoVp2S0opU8I8lMhq1Ig=" Decrypted: string(4) "tesr"
Output for 5.5.27
Encrypted: string(44) "KHmqsvatzyt6zHpuBRIinIHD7O7k4BzxISN/A8Pkgf4=" Decrypted: string(4) "tesr"
Output for 5.5.26
Encrypted: string(44) "M1RDM2NeDkw+FosABCNJpyWsGziiECLjcnpBWrGTzWk=" Decrypted: string(4) "tesr"
Output for 5.5.25
Encrypted: string(44) "Ti+YT1Kr79BwdPOJUMIQ/Aoh+h3/+gYME9GIndcDqQw=" Decrypted: string(4) "tesr"
Output for 5.5.24
Encrypted: string(44) "0zyVcJuATCEYvqQSTvNee4OFIj4eOw7a3pG1klHloDY=" Decrypted: string(4) "tesr"
Output for 5.4.45
Encrypted: string(44) "O5JlSdzphQX7nbAKJbTfI64cwFnnQejoajDx1mdN+PE=" Decrypted: string(4) "tesr"
Output for 5.4.44
Encrypted: string(44) "kSAy7AYrS2ntN+83Ys6vKp6sSJ426WoAchocm7fBHn8=" Decrypted: string(4) "tesr"
Output for 5.4.43
Encrypted: string(44) "tUHDzNDhKn3Bjoyun1owkMd/CPll5YhfNCcvHdp9KcY=" Decrypted: string(4) "tesr"
Output for 5.4.42
Encrypted: string(44) "wFjV768JUNR/vnEEIN0o8NBvWYhieSthR+1VDp/MoI8=" Decrypted: string(4) "tesr"
Output for 5.4.41
Encrypted: string(44) "Y4LWkY1AY/MzutXxXzpJ2FMIpo/QrTZxrMHKWTwJHGU=" Decrypted: string(4) "tesr"
Output for 5.4.40
Encrypted: string(44) "Nhgf1FMnu/MlZqolzXEVpC3pUwuV1rKUGnbadeJM9uU=" Decrypted: string(4) "tesr"
Output for 5.4.39
Encrypted: string(44) "2jft9NgR17vQmg4+qafmBiWr4b5s13IHeo6Pc5Dspyo=" Decrypted: string(4) "tesr"
Output for 5.4.38
Encrypted: string(44) "JMo8DIuKrHVy0a7MZ0fGrL+BtVSaLozVr1qcYCm8r5g=" Decrypted: string(4) "tesr"
Output for 5.4.37
Encrypted: string(44) "atCI154kCnyty1d3tClAzzCfESB37JqPt05nBIT47pc=" Decrypted: string(4) "tesr"
Output for 5.4.36
Encrypted: string(44) "WqPDPYrCx90XEzJ7Jw465Q3GpS/qmgT1xuO5zRI3RoI=" Decrypted: string(4) "tesr"
Output for 5.4.35
Encrypted: string(44) "DhsetdXVZxZ80C84gK+Jt54GVZ0Kl/HLngNa+MsdAPI=" Decrypted: string(4) "tesr"
Output for 5.4.34
Encrypted: string(44) "O6pJyKIQnivnfJBFZxiaWEXn4AfWJzXcL9zX5LRahTU=" Decrypted: string(4) "tesr"
Output for 5.4.32
Encrypted: string(44) "SywMjjf+nKe+Cgc5+K9OnSivkLuYPurCEZ3kxN2tk9M=" Decrypted: string(4) "tesr"
Output for 5.4.31
Encrypted: string(44) "SVZ3KVVDapotdKv27OIClX+ZOi8Gk+2q2yF8dGzQ9tg=" Decrypted: string(4) "tesr"
Output for 5.4.30
Encrypted: string(44) "hGpJvoY5a56LsqQNOOFhMDEEdQl8YjDeALaTOwni9+g=" Decrypted: string(4) "tesr"
Output for 5.4.29
Encrypted: string(44) "8bLbRQaZO8byZMHVreYQEHlmeRBznbRptqPsFCzA174=" Decrypted: string(4) "tesr"
Output for 5.4.28
Encrypted: string(44) "4438oYH/07Eo1e/A28JOy0UiFXQaW10kmDJ71vSwAuE=" Decrypted: string(4) "tesr"
Output for 5.4.27
Encrypted: string(44) "9d4xkOXh0PIW8eWFYUOYLziusqEYxsFW7w2XVONDdMI=" Decrypted: string(4) "tesr"
Output for 5.4.26
Encrypted: string(44) "ZYIMvwew9JQjIPJu7zJQeaJaup62LB/60bsbEjaaIOM=" Decrypted: string(4) "tesr"
Output for 5.4.25
Encrypted: string(44) "3mzuzWjGAzwqDUkp0RzHay+vK4mAMBizbto8uyuvW0c=" Decrypted: string(4) "tesr"
Output for 5.4.24
Encrypted: string(44) "9EMPF9WIwzoFK17yjGEIylreL3Q406GouhKwfOFIWow=" Decrypted: string(4) "tesr"
Output for 5.4.23
Encrypted: string(44) "NZTd/tmVJR6n9OU944TvI4tVgfO2TN3wpy4XD5sWoXE=" Decrypted: string(4) "tesr"
Output for 5.4.22
Encrypted: string(44) "uJL2Tn3Hb2fZX18nYa9UFBnS+DnH0fZQW551pCj0eLM=" Decrypted: string(4) "tesr"
Output for 5.4.21
Encrypted: string(44) "d6OVgNeD1zDkY3NrfY/MPPOnGil4/C/54IZ+4hGC6cY=" Decrypted: string(4) "tesr"
Output for 5.4.20
Encrypted: string(44) "qZlrbg8Q/FhK2TO7Nf9CGG+rvSfAP1LU3yBydyq4ADs=" Decrypted: string(4) "tesr"
Output for 5.4.19
Encrypted: string(44) "LKLSLNbeis/HC0B1clo4VARBjku+rrqurPo43VzvyIA=" Decrypted: string(4) "tesr"
Output for 5.4.18
Encrypted: string(44) "WRmGeB9jHz93dttURol1V9Q4fXcE5M8wN90+Bc+MtsM=" Decrypted: string(4) "tesr"
Output for 5.4.17
Encrypted: string(44) "puS+ZzGhz8gzPVeVoQ+7OUU2JX3sv7gKy+aXUJgKSVs=" Decrypted: string(4) "tesr"
Output for 5.4.16
Encrypted: string(44) "TId3yvGf18Le6JYvUbpajRSUgMa5FYGNXKFErZaCIMg=" Decrypted: string(4) "tesr"
Output for 5.4.15
Encrypted: string(44) "YgZ177Y/eZDdY0emdDjqs0XKi0zRfRUBpLJa4EKcEh8=" Decrypted: string(4) "tesr"
Output for 5.4.14
Encrypted: string(44) "/Xm0QfZgielConTCXatYOnq+MGNIWD0wrV3z3fSQL+Q=" Decrypted: string(4) "tesr"
Output for 5.4.13
Encrypted: string(44) "E6vpKpICdAiEzNZIpuOtGLGfXVG65H8anO1uuw01CVI=" Decrypted: string(4) "tesr"
Output for 5.4.12
Encrypted: string(44) "7zZQTHVZlvtzBGvmLvC/Nu0Yk8bUqd/PIuHbhLOXEcA=" Decrypted: string(4) "tesr"
Output for 5.4.11
Encrypted: string(44) "rNC3o66WXwMJHmudNx8Umr+BFDYz4dHpmScOyPCUZxM=" Decrypted: string(4) "tesr"