3v4l.org

run code in 300+ PHP versions simultaneously
<?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;
Output for 7.0.0 - 7.0.15, 7.1.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.

preferences:
164.68 ms | 1395 KiB | 25 Q