View Single Post
Old 11.08.2007, 17:10   #20
Phantom2005
Архивный участник
 
Join Date: Aug 2005
Posts: 394
Default

I'd personally exchange:
Code:
	$nBytes = strlen($str);
	
	while ($i < $nBytes)
	{
		$i++; 
		$key[$i] = ord(substr($str, $i - 1, 1)); 
		$dst[$i] = $key[$i];
	}
for
Code:
	while ($i < 16) {
		$i++;
		$key[$i] = '';
		$dst[$i] = '';
		$key[$i] = ord(substr($str, $i - 1, 1));
		$dst[$i] = $key[$i];
	}
A password can not be bigger then 16 chars. ( quote l2cp: if(strlen($password) < 4 || strlen($password) > 16) { )
If you don't do this there will be $key's that will remain "undefined".
If you have error_reporting on E_ALL you will have a few warnings.
If you exchange that part with my code those warnings will be gone + will work fine.
Phantom2005 is offline