php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #2371 Null bytes at the end of arrays returned from decrypting information
Submitted: 1999-09-24 01:02 UTC Modified: 1999-09-26 10:47 UTC
From: celer at ipro dot lug dot usf dot edu Assigned:
Status: Closed Package: mcrypt related
PHP Version: 4.0 Beta 2 OS: Linux/RedHat 6.0
Private report: No CVE-ID: None
 [1999-09-24 01:02 UTC] celer at ipro dot lug dot usf dot edu
$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!

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [1999-09-26 10:47 UTC] sas at cvs dot php dot net
Data is always padded with NUL bytes to match the block size of the used block algorithm.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu Dec 26 20:01:29 2024 UTC