3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php const ENC_METHOD = 'aes-256-ctr'; const ENC_SALT = "87CD2488-180D-442B-A68A-0307DC0CAB4D"; function B2R_Encrypt($message, $key) { $key = hash("sha256", ENC_SALT, FALSE); //$key = hash("sha256", ENC_SALT + $key, TRUE); echo $key; $nonceSize = openssl_cipher_iv_length(ENC_METHOD); $nonce = openssl_random_pseudo_bytes($nonceSize); $ciphertext = openssl_encrypt( $message, ENC_METHOD, $key, OPENSSL_RAW_DATA, $nonce ); $result = base64_encode($nonce.$ciphertext); echo $result + ''\n'; return $result; } $message = 'Some test password'; $encrypted = B2R_Encrypt($message, ''); echo $encrypted;
based on bZPZG
Output for 5.6.0 - 5.6.30, 7.0.0 - 7.1.1
Parse error: syntax error, unexpected '\' (T_NS_SEPARATOR), expecting ',' or ';' in /in/psemh on line 26
Process exited with code 255.
Output for hhvm-3.15.4
Fatal error: Uncaught Error: syntax error, unexpected T_NS_SEPARATOR, expecting ',' or ';' in /in/psemh:26 Stack trace: #0 {main}
Process exited with code 255.