"I have a string encrypted with mcrypt and encoded in base64. I unbase64 this string and I decrypt it using mcrypt. I looks like I got the exact same string but when I compare it with == it is not the same."


<?php
  $td 
= @mcrypt_module_open('rijndael-128''''ecb''');
                                                                                                                                              
  
$iv_size  mcrypt_enc_get_iv_size($td);
  
$key_size mcrypt_enc_get_key_size($td);
  
$key substr(sha1('very secret key'), 0$key_size);

  
/* Init encryption module */
  
@mcrypt_generic_init($td$key'');

  
/* Decrypt text */
  
$text mdecrypt_generic($td$crypt_text);
  echo 
$text;
?>