title: PHP switch from MCRYPT_MODE_ECB to AES-256-ECB
body: <p>I am rewriting code to be compatible with PHP 7.2. Old code is</p>
  
  <pre><code>public function encryptPasswordOld($password, $salt)
  {
      $key = md5($salt);
      $result = mcrypt_encrypt(MCRYPT_RIJNDAEL_128, $key, $password, MCRYPT_MODE_ECB);
      return base64_encode($result);
  }
  </code></pre>
  
  <p>New code should be according to my research something like this</p>
  
  <pre><code>public function encryptPasswordNew($password, $salt)
  {
      $method = 'AES-256-ECB';
      $ivSize = openssl_cipher_iv_length($method);
      $iv = openssl_random_pseudo_bytes($ivSize);
      $key = md5($salt);
      $result = openssl_encrypt($password, $method, $key, OPENSSL_RAW_DATA, $iv);
      return base64_encode($result);
  }
  </code></pre>
  
  <p>but I tried every combination of openssl_encrypt options: <code>OPENSSL_RAW_DATA</code>, <code>OPENSSL_RAW_DATA | OPENSSL_ZERO_PADDING</code>, <code>OPENSSL_ZERO_PADDING</code>, <code>0</code> and still ended up with different result as the old method returns</p>