title: Mcrypt and encript in php 7.2
body: <pre><code>final class Encryption {
      private $key;
  
      public function __construct($key) {
          $this-&gt;key = hash('sha256', $key, true);
      }
  
      public function encrypt($value) {
          return strtr(base64_encode(mcrypt_encrypt(MCRYPT_RIJNDAEL_256, hash('sha256', $this-&gt;key, true), $value, MCRYPT_MODE_ECB)), '+/=', '-_,');
      }
  
      public function decrypt($value) {
          return trim(mcrypt_decrypt(MCRYPT_RIJNDAEL_256, hash('sha256', $this-&gt;key, true), base64_decode(strtr($value, '-_,', '+/=')), MCRYPT_MODE_ECB));
      }
  }
  </code></pre>
  
  <p>The above code does not work anymore in php 7.2 because of the mcrypt function. How can I convert it to some equivalent function in php 7.2?</p>