#44714 [Opn->Bgs]: Mcrypt decrypt output bug in Firefox
| From: | derick@php.net | Date: | Mon, 14 Apr 2008 16:32:51 +0000 |
| Subject: | #44714 [Opn->Bgs]: Mcrypt decrypt output bug in Firefox | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-124223@lists.php.net to get a copy of this message | ||
ID: 44714
Updated by: derick@php.net
Reported By: isedc at yahoo dot com
-Status: Open
+Status: Bogus
Bug Type: mcrypt related
Operating System: Windows Vista
PHP Version: 5.2.5
New Comment:
Thank you for taking the time to write to us, but this is not
a bug. Please double-check the documentation available at
http://www.php.net/manual/ and the instructions on how to
report
a bug at http://bugs.php.net/how-to-report.php
XTEA is a block algorithm, so it only encrypts/decrypts in blocks. It
will therefore pad the string with \0 bytes up until the block size.
Those you see as ? when outputting the decrypted result.
Previous Comments:
------------------------------------------------------------------------
[2008-04-14 07:12:09] isedc at yahoo dot com
Description:
------------
Following an MCRYPT example on php.net, when decrypting a string that
is less than 8 characters, will output in firefox and appended with ?
marks to fill the other characters.
Example: ecrypted string is 4 characters long (abcd), when decrypting
the string and outputting to firefox displays: abcd????
This was tested with Firefox 2.0.13. This does not appear to affect
Internet Explorer 7.
Reproduce code:
---------------
$key = "d9Qg%R*";
$text = "abcd";
$iv_size = mcrypt_get_iv_size(MCRYPT_XTEA, MCRYPT_MODE_ECB);
$iv = mcrypt_create_iv($iv_size, MCRYPT_RAND);
$enc = mcrypt_encrypt(MCRYPT_XTEA, $key, $text, MCRYPT_MODE_ECB, $iv);
$crypttext = mcrypt_decrypt(MCRYPT_XTEA, $key, $enc, MCRYPT_MODE_ECB,
$iv);
echo $crypttext;
Expected result:
----------------
echo output should be: abcd
Actual result:
--------------
echo output is actually: abcd????
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=44714&edit=1