3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php $key = "abcdefg123456789"; $iv = "abcdefghijkl"; $token = "password"; print "Token: " . base64_encode($token) . "\n"; print "\n"; $cipher = openssl_encrypt($token, 'aes-128-ecb', $key, OPENSSL_RAW_DATA); print "Cipher: " . $cipher . "\n"; print "Error: " . openssl_error_string() . "\n"; print "\n"; $plain = openssl_decrypt($cipher, 'aes-128-ecb', $key, OPENSSL_RAW_DATA); print "Token: " . base64_encode($token) . "\n"; print "Cipher: " . base64_encode($cipher) . "\n"; print "Plain: " . $plain . "\n"; var_dump(openssl_error_string());
based on t8dF3
Output for 5.4.15 - 7.1.0
Token: cGFzc3dvcmQ= Cipher: �}y�x�}�ʨ7(Ig Error: Token: cGFzc3dvcmQ= Cipher: 4315+ngZt33/yqg3KElnCQ== Plain: password bool(false)
Output for 5.0.0 - 5.4.14
Token: cGFzc3dvcmQ= Fatal error: Call to undefined function openssl_encrypt() in /in/1tm55 on line 9
Process exited with code 255.
Output for 4.4.5 - 4.4.9
Token: cGFzc3dvcmQ= Fatal error: Call to undefined function: openssl_encrypt() in /in/1tm55 on line 9
Process exited with code 255.
Output for 4.3.2 - 4.4.4
Token: cGFzc3dvcmQ= Fatal error: Call to undefined function: openssl_encrypt() in /in/1tm55 on line 9
Process exited with code 255.
Output for 4.3.0 - 4.3.1
Token: cGFzc3dvcmQ= Fatal error: Call to undefined function: openssl_encrypt() in /in/1tm55 on line 9