title: Equivalent Encryption for MCRYPT - To preserve client side code
body: <p>I'm using the following code to perform encryption using mcrypt</p>
  
  <pre><code>&lt;?PHP
  
      define('SECURE_KEY','Somekey');
  
      function encrypt($value){
          $iv_size = mcrypt_get_iv_size(MCRYPT_RIJNDAEL_256, MCRYPT_MODE_ECB);
          $iv = mcrypt_create_iv($iv_size, MCRYPT_RAND);
          return mcrypt_encrypt(MCRYPT_RIJNDAEL_256, SECURE_KEY, $value, MCRYPT_MODE_ECB, $iv);
      }
  
      function decrypt($value){
          $iv_size = mcrypt_get_iv_size(MCRYPT_RIJNDAEL_256, MCRYPT_MODE_ECB);
          $iv = mcrypt_create_iv($iv_size, MCRYPT_RAND);
          return trim(mcrypt_decrypt(MCRYPT_RIJNDAEL_256, SECURE_KEY, $value, MCRYPT_MODE_ECB, $iv));
      }
      $temp=encrypt("teststring");
      printf($temp);
      ?&gt;
  </code></pre>
  
  <p>The newer versions of php depreciates mcrypt,im looking for a replacement for the same that works with the same key and produces the same result,so that i dont need to change client side code.</p>