3v4l.org

run code in 300+ PHP versions simultaneously
<?php declare(strict_types=1); class SensitiveInfo { private $cipher = "AES-256-CBC"; private $secret_key = "fj239fDSDf932kk21c"; private $secret_iv = "3fn4d2k3j3nxdlpo32"; private $options = 0; private $iv = null; public function __construct() { $this->secret_key = hash('sha256', $this->secret_key); $this->iv = substr(hash('sha256', $this->secret_iv), 0, 16); }//end __construct() public function hide(string $str): string { return base64_encode(openssl_encrypt( $str, $this->cipher, $this->secret_key, $this->options, $this->iv )); }//end maskData() public function unhide(string $str) { $str = base64_decode($str); return openssl_decrypt( $str, $this->cipher, $this->secret_key, $this->options, $this->iv ); }//end maskData() }//end class $si = new SensitiveInfo(); $encrypted = $si->hide("Hello World"); var_dump($encrypted); var_dump($si->unhide($encrypted));
Output for 7.3.0 - 7.3.33, 7.4.0 - 7.4.33, 8.0.0 - 8.0.30, 8.1.0 - 8.1.28, 8.2.0 - 8.2.18, 8.3.0 - 8.3.4, 8.3.6
Fatal error: Uncaught Error: Call to undefined function openssl_encrypt() in /in/Xi5WF:28 Stack trace: #0 /in/Xi5WF(48): SensitiveInfo->hide('Hello World') #1 {main} thrown in /in/Xi5WF on line 28
Process exited with code 255.
Output for 8.3.5
Warning: PHP Startup: Unable to load dynamic library 'sodium.so' (tried: /usr/lib/php/8.3.5/modules/sodium.so (libsodium.so.23: cannot open shared object file: No such file or directory), /usr/lib/php/8.3.5/modules/sodium.so.so (/usr/lib/php/8.3.5/modules/sodium.so.so: cannot open shared object file: No such file or directory)) in Unknown on line 0 Fatal error: Uncaught Error: Call to undefined function openssl_encrypt() in /in/Xi5WF:28 Stack trace: #0 /in/Xi5WF(48): SensitiveInfo->hide('Hello World') #1 {main} thrown in /in/Xi5WF on line 28
Process exited with code 255.

preferences:
165.67 ms | 402 KiB | 156 Q