I posted this in the general help originally, but I suspect it's more appropriate here.
Hello kind sirs. I have apache2 running php5 with mcrypt compiled in and working (for the most part). I am having a small problem with the resulting string after decrypting, however, in my test run. Basically, it seems to encrypt and then decrypt the text properly, but after decrypting, the resulting string has some extra data on the end of it because in firefox I see a couple of those wierd blocks after the text.
Here's my code:
$string = "This is encrypted text";
$key = "SECRET";
// make an iv value, whatever that's for
$ivsize = mcrypt_get_iv_size(MCRYPT_BLOWFISH, MCRYPT_MODE_ECB);
$iv = mcrypt_create_iv($ivsize, MCRYPT_RAND);
// encrypt string
$encrypted_string = mcrypt_encrypt(MCRYPT_BLOWFISH, $key, $string, MCRYPT_MODE_ECB, $iv);
// decrypt string
$decrypted_string = mcrypt_decrypt(MCRYPT_BLOWFISH, $key, $encrypted_string, MCRYPT_MODE_ECB, $iv);
// print it
echo "Decrypted string is: $decrypted_string<br><br>";
You can see the bizarre output I am referring to by checking out this screenshot.
So, any ideas what's causing those to be left behind?
edit: fixed screenshot link