3v4l.org

run code in 300+ PHP versions simultaneously
<?php function decryptData($value){ $key = "ICS2015"; $crypttext = base64_decode($value); $iv_size = mcrypt_get_iv_size(MCRYPT_RIJNDAEL_256, MCRYPT_MODE_ECB); $iv = mcrypt_create_iv($iv_size, MCRYPT_RAND); $decrypttext = mcrypt_decrypt(MCRYPT_RIJNDAEL_256, $key, $crypttext, MCRYPT_MODE_ECB, $iv); return trim($decrypttext); } function encryptData($value) { $key = "ICS2015"; $text = $value; // getting the size of the IV (Initialization Vector) belonging to a specific cipher / mode combination // Accept two params // 1: cipher (MCPYPT_ciphername constraint or the name of algorithms string) // 2: mode (MCPYPT_MODE_modename constraint or one of the following string - ecb, cbc, cfb, ofb, nofb or stream ) $iv_size = mcrypt_get_iv_size(MCRYPT_RIJNDAEL_256, MCRYPT_MODE_ECB); // Create an initialization vector(IV) from RANDOM source $iv = mcrypt_create_iv($iv_size, MCRYPT_RAND); // Encrypt plaintext with given params $crypttext = mcrypt_encrypt(MCRYPT_RIJNDAEL_256, $key, $text, MCRYPT_MODE_ECB, $iv); return base64_encode($crypttext); } $data = 'testdata'; $encData = encryptData($data); $decData = decryptData($encData); echo $data; echo $encData; echo $decData; ?>
Output for git.master, git.master_jit, rfc.property-hooks
Fatal error: Uncaught Error: Call to undefined function mcrypt_get_iv_size() in /in/AZM5H:22 Stack trace: #0 /in/AZM5H(33): encryptData('testdata') #1 {main} thrown in /in/AZM5H on line 22
Process exited with code 255.

This tab shows result from various feature-branches currently under review by the php developers. Contact me to have additional branches featured.

Active branches

Archived branches

Once feature-branches are merged or declined, they are no longer available. Their functionality (when merged) can be viewed from the main output page


preferences:
55.17 ms | 401 KiB | 8 Q