title: PHP's mcrypt_encrypt and openssl command line output different cipher
body: <p>I am new to encryption. I want to encode a string with AES 128bit encryption. I can do this in PHP:</p>
  
  <pre><code>$key = 'Hello';
  $plain = 'Hello Hello Hello Hello';
  
  $cipher = mcrypt_encrypt(MCRYPT_RIJNDAEL_128, $key, $plain, MCRYPT_MODE_CBC);
  
  echo base64_encode($cipher);
  </code></pre>
  
  <p>This outputs:</p>
  
  <pre><code>bzXdTNochlsQwpR9hzSSS6ihG+MYIZIDZZlF85pIXlQ=
  </code></pre>
  
  <p>I tried the same with openssl command line:</p>
  
  <pre><code>openssl enc -aes-128-cbc -a -nosalt -in plain.txt -out encrypted.enc -pass pass:Hello
  </code></pre>
  
  <p>And the string saved in encrypted.enc is:</p>
  
  <pre><code>5apwiN8MdAuJ9nEW82XMyR0H3VKpI/vWc7xV2iVjCTE=
  </code></pre>
  
  <p>Why is it different?</p>
  
  <p>The reason why I am trying to get the same output with both PHP and command line openssl is because I will have two separate web services communicating together. One service will have PHP available so I can use that but the other one will not be using PHP so I will probably have to use openssl in command line.</p>