ID: 44714 Updated by: [EMAIL PROTECTED] 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
