ID:               17062
 Updated by:       [EMAIL PROTECTED]
 Reported By:      [EMAIL PROTECTED]
-Status:           Open
+Status:           Closed
 Bug Type:         mcrypt related
 Operating System: Unix
 PHP Version:      4.2.0
 New Comment:

It's indeed intended, as you might want to encrypt/decrypt a range of
\0's.. PHP should not trim the result. As most encrypt algorithms do
not store the length of the original string in the output, there is no
way for PHP to tell where the decrypted string should end.
A workaround here would be to use trim() (www.php.net/trim) on the
decrypted string to remove the trailing \0's.

Derick


Previous Comments:
------------------------------------------------------------------------

[2002-05-06 23:49:27] [EMAIL PROTECTED]

I noticed something quite strange when using the mcrypt library to
encrypt data.

say i would encrypt $data in mode ECB:
$l = mcrypt_encrypt(MCRYPT_BLOWFISH, $key, $data, MCRYPT_MODE_ECB,
$iv);

then decrypt it:
$l = mcrypt_decrypt(MCRYPT_BLOWFISH, $key, $data, MCRYPT_MODE_ECB,
$iv);

It seems like the padding prevents me from using the variable correctly
in some conditions.
As explained in the documentation, the padding is made of '\0' and in
the following example:

<? exec("echo.sh $l foobar", $value, $return);

exec would actually stop at $l because of the '\0' and not pass the
'foobar' arg.
I don't know if this is a known bug or a "supposed" behaviour, but it
is surely annoying  :)



------------------------------------------------------------------------


-- 
Edit this bug report at http://bugs.php.net/?id=17062&edit=1

Reply via email to