PHP 4.0 Bug #2371: Null bytes at the end of arrays returned from decrypting information
| From: | celer at ipro dot lug dot usf dot edu | Date: | Fri, 24 Sep 1999 05:02:22 +0000 |
| Subject: | PHP 4.0 Bug #2371: Null bytes at the end of arrays returned from decrypting information | ||
| Groups: | php.dev | ||
| Request: | Send a blank email to php-dev+get-11261@lists.php.net to get a copy of this message | ||
From: celer@ipro.lug.usf.edu
Operating system: Linux/RedHat 6.0
PHP version: 4.0 Beta 2
PHP Bug Type: mcrypt related
Bug description: Null bytes at the end of arrays returned from decrypting information
$ct=mcrypt_cbc(MCRYPT_TWOFISH128,$key,$ciphertext,MCRYPT_DECRYPT); will return a string with null
characters at the end of it. This defies common sense. I end up having to run the returned string
trough a for-loop to remove the null characters.
i.e.
for($i=0;$i<strlen($ct);$i++)
{
if(ord($ct[$i])!=0)
$nct=$nct.$ct[$i];
}
return $nct;
It does not matter what type of encryption is specifed. Thanks, zend rocks so far!