3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php function encrypt($string, $salt = NULL){ $mcrypt_iv_size = mcrypt_get_iv_size(MCRYPT_RIJNDAEL_128, MCRYPT_MODE_ECB); $mcrypt_iv = mcrypt_create_iv($mcrypt_iv_size, MCRYPT_RAND); $mcrypted = mcrypt_encrypt(MCRYPT_RIJNDAEL_128, hash('md5', $salt, true), $string, MCRYPT_MODE_ECB, $mcrypt_iv); $encoded = base64_encode($mcrypted); return $encoded; } function decrypt($hash, $salt = NULL){ $mcrypt_iv_size = mcrypt_get_iv_size(MCRYPT_RIJNDAEL_128, MCRYPT_MODE_ECB); $mcrypt_iv = mcrypt_create_iv($mcrypt_iv_size, MCRYPT_RAND); $basedecoded = base64_decode($hash); $mcrypted = mcrypt_decrypt(MCRYPT_RIJNDAEL_128, hash('md5', $salt, true), $basedecoded, MCRYPT_MODE_ECB, $mcrypt_iv); return $mcrypted; } $en = encrypt('Lorem ipsum dolor sit amet, consectetur adipiscing elit. Suspendisse ullamcorper turpis ut purus ultricies rhoncus. Suspendisse potenti. Donec nec tempor erat. Duis cursus tempus metus, ac elementum risus interdum nec. Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Integer non dui vel ligula vestibulum tristique. Suspendisse vel purus erat. Cras sollicitudin arcu et leo mollis, ac elementum leo venenatis. Donec enim felis, congue quis finibus ut, imperdiet at nulla. Duis sit amet turpis diam. Morbi a iaculis massa. Vestibulum sodales, nisl ac tempus rhoncus, magna urna tempor leo, in faucibus quam tellus quis sem. Nam euismod fringilla orci pellentesque porta. Curabitur a metus sed mauris pharetra blandit. Suspendisse a euismod augue. Praesent gravida tortor vitae magna sodales, ac pretium tortor fermentum. Donec ante nulla, consequat ut faucibus quis, dapibus ac eros. Nullam eleifend, nulla eget ultricies pulvinar, tellus mi pellentesque erat, vitae rutrum dolor tellus sed purus. Sed elementum enim at risus placerat, et vestibulum elit egestas. Maecenas ultricies commodo ligula sed tristique. Donec interdum odio justo, quis condimentum risus consectetur sit amet. Suspendisse iaculis, leo vitae ultrices mattis, libero mauris commodo risus, ut dictum diam ex ut lacus. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia Curae; Etiam pellentesque libero libero, eu faucibus ligula dictum vel. Aliquam erat volutpat. Proin tristique sodales diam, ut fringilla ipsum pellentesque nec. Morbi laoreet nec massa a tincidunt. Nullam nisi felis, consectetur vel tempus id, iaculis at magna. Etiam dictum, nisi non facilisis eleifend, odio nisi aliquet massa, id egestas magna augue at elit. Morbi pellentesque est non dui sagittis tempus. Maecenas nisi mi, ullamcorper ut massa vel, dignissim dictum nisi. Maecenas pharetra efficitur metus. Aenean non ultrices odio. Maecenas bibendum hendrerit consectetur. Nam vel lorem felis. Curabitur velit ipsum, viverra nec lacinia in, consequat non lacus. Donec tincidunt commodo elit, ut varius nibh ultricies et. Duis interdum urna sed sem sollicitudin sollicitudin. Nam auctor, nulla eget tincidunt euismod, sem tortor pellentesque augue, vel aliquet nunc mi eget massa. Phasellus porttitor eu mi vitae suscipit. In efficitur ligula eu turpis mattis lobortis. Donec lacinia cursus magna id tristique. Fusce ut enim eget nulla accumsan imperdiet. Vestibulum dignissim turpis non magna facilisis dictum. Suspendisse at tortor nibh. Nullam cursus felis quam, vel rhoncus sapien auctor viverra. Suspendisse a bibendum ante, nec tempor mauris. Aliquam ligula turpis, condimentum at suscipit ut, tincidunt quis leo. Proin id leo a neque hendrerit hendrerit. Curabitur orci nunc, rhoncus quis ultrices nec, venenatis sit amet enim. Etiam porta mi sed nulla fringilla hendrerit.', hash('sha512', 'test')); echo $en;
based on hega8
Output for 7.0.6 - 7.1.0
Fatal error: Uncaught Error: Call to undefined function mcrypt_get_iv_size() in /in/aGmE8:4 Stack trace: #0 /in/aGmE8(33): encrypt('Lorem ipsum dol...', 'ee26b0dd4af7e74...') #1 {main} thrown in /in/aGmE8 on line 4
Process exited with code 255.
Output for 5.4.34 - 5.5.34, 5.6.8 - 5.6.20, hhvm-3.10.0 - 3.12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svgY/LUwCJeL/gXRYhdYAxh6877ZU9KXrfg60BmAzBrXnZlMXz1wfmxn7EskEfcNrNBykHsQIG/MzPYo696VZTeUS4muO71G1noX5VCS6uAh0gjI0puZ8aBh0f4A3zZ/1oN65kdl55DVc3JQNF6EpShlzPe8n7ip5fwXbpTZGRopQCDUVwzqdGAtouBsF2XY49IXZaVJTXyIq2lYTX+H1Kn0A5xyFhjhpVJp1wu2yqvPkg7flX1aU6z6RxWuI2CkQbttZrYCtu/WR7rfupa0RdJvrv+qugWRLGyFEbSD6LeNsdnYOe76+vwnowGx2U+gEDUxI60cZLBz4HH2vfyONP8CjswBei6zJVZ1KyrsvjkX57MPVM/z2ba01zFu70R5NZE0pj1nIhd9I4lA0MUk07mivf5UsCLTyZA8JqOcyTovabj8eR2BLvqDP3+tHpmw7wQwVAMKfSvMKJQpLweCH7/Z9pO8LX5U7zXnbcMX+rQMo/I8NemOKiu1HGYT5uKnd5k9gNQIb7JFBxQzl6TBaBR8xD7hvjE5jG4JJgmmhhMC/t2YHawdMiE+6p0swdrrMy+7oK97IB32K9EWc62twNtnHfR2eOFHnFviQhMOAJv9MBfxUEDEqiqa9/u4vyb2WUunnBeteMA1TYOi68nirbH4+MpcFVmWKlW0s=
Output for 5.1.2 - 5.4.32, 5.5.35, 5.6.21 - 5.6.28
Fatal error: Call to undefined function mcrypt_get_iv_size() in /in/aGmE8 on line 4
Process exited with code 255.
Output for 5.0.0 - 5.1.1
Fatal error: Call to undefined function hash() in /in/aGmE8 on line 33
Process exited with code 255.
Output for 4.4.5 - 4.4.9
Fatal error: Call to undefined function: hash() in /in/aGmE8 on line 33
Process exited with code 255.
Output for 4.3.2 - 4.4.4
Fatal error: Call to undefined function: hash() in /in/aGmE8 on line 33
Process exited with code 255.
Output for 4.3.0 - 4.3.1
Fatal error: Call to undefined function: hash() in /in/aGmE8 on line 33