title: Using PHP mcrypt with Rijndael/AES
body: <p>I am trying to encrypt some text messages using mcrypt from php and the cipher Rijndael, but I am not sure about the MCRYPT_MODE_modename (according to PHP's manual these are available "ecb", "cbc", "cfb", "ofb", "nofb" or "stream" but I read there are actually a few more). I have no idea what each one do or how to use them.</p>
  
  <p>I read two things, that ECB mode should not be used and MCRYPT_RAND neither. They didn't explain why. For the ECB mode I guess it's because it always generate the same encrypted output for the same plain text (maybe this could be used for an attack), no idea about MCRYPT_RAND (mentioned by @azz <a href="https://stackoverflow.com/questions/5108408/php-mcrypt-which-mode">here</a>).</p>
  
  <p>My question is, <em>what mcrypt mode should I use, and it would be great to see an example of php code using</em> it because all the examples I found use ECB. The strings I am trying to encrypt will contain only ascii text, and variable length, not bigger than 500 chars.</p>