title: php decrypt string with MCRYPT_RIJNDAEL_256
body: <pre><code>&lt;?php
  function encrypt ($key,$iv,$str)
  {     
    $block=mcrypt_get_block_size(MCRYPT_RIJNDAEL_256, MCRYPT_MODE_CBC);
    $padding=$block-(strlen($str) % $block);
    $str.=str_repeat(chr($padding), $padding);  
    $encryptxt=mcrypt_encrypt(MCRYPT_RIJNDAEL_256,$key,$str,MCRYPT_MODE_CBC,$iv);  
    $encryptxt64=base64_encode($encryptxt);
    return $encryptxt64;
  }
  function decrypt ($key,$iv,$str)
  {     
    $block=mcrypt_get_block_size(MCRYPT_RIJNDAEL_256, MCRYPT_MODE_CBC);
    $padding=$block-(strlen($str) % $block);
    $str.=str_repeat(chr($padding), $padding);  
    $decryptxt=mcrypt_decrypt(MCRYPT_RIJNDAEL_256,$key,$str,MCRYPT_MODE_CBC,$iv);  
    $decryptxt64=base64_decode($decryptxt);
    return $decryptxt64;
  }
  echo encrypt("1234567890123456","12345678901234561234567890123456","test")."\n&lt;br/&gt;";
  echo decrypt("1234567890123456","12345678901234561234567890123456","xHqKvRQ6FXehOGGMrKoek04146M2l9bv1ScP6C1qCyg=")."\n&lt;br/&gt;";
  ?&gt;
  </code></pre>
  
  <p>I found this way can encrypt string,works fine,but when I tried to decrypt a string,above codes does not working.
  the decrypt output likes </p>
  
  <p>�   S�'=�ɚ?� </p>
  
  <p>Does anybody know how to fix the decrypt part?Thanks in advance!</p>